| | |
| | | require('../../pages/join-statistic/join-statistic?hash=96494a69a77c04a2a41944933b5875740b0d9262'); |
| | | require('../../pages/advice/advice?hash=c38b953af6bdab8fe399141b33dd1ad1ceb7ea7f'); |
| | | require('../../pages/activity-detail/activity-detail?hash=3ff7dd30a3ea0de70909d48b0b8ce5bda62ef62e'); |
| | | require('../../pages/assist-process/assist-process?hash=c6818e0a77e4e2f8365cc6ed1a93960827e43474'); |
| | | require('../../pages/lucky-coupon/lucky-coupon?hash=c6818e0a77e4e2f8365cc6ed1a93960827e43474'); |
| | | require('../../pages/assist-process/assist-process?hash=f1b7dc4ca438ceda80574161c70b1f25cb9fb567'); |
| | | require('../../pages/lucky-coupon/lucky-coupon?hash=f1b7dc4ca438ceda80574161c70b1f25cb9fb567'); |
| | | require('../../pages/msg-record/msg-record?hash=59bab5c4a4a4ec930e168925c97c3057ac83fa7d'); |
| | | require('../../pages/assist-friends/assist-friends?hash=59bab5c4a4a4ec930e168925c97c3057ac83fa7d'); |
| | | require('../../pages/msg-setting/msg-setting?hash=5f504890acbcf3bad0486fc198ac7448dd406718'); |
| | |
| | | require('../../pages/join-statistic/join-statistic?hash=96494a69a77c04a2a41944933b5875740b0d9262'); |
| | | require('../../pages/advice/advice?hash=c38b953af6bdab8fe399141b33dd1ad1ceb7ea7f'); |
| | | require('../../pages/activity-detail/activity-detail?hash=3ff7dd30a3ea0de70909d48b0b8ce5bda62ef62e'); |
| | | require('../../pages/assist-process/assist-process?hash=c6818e0a77e4e2f8365cc6ed1a93960827e43474'); |
| | | require('../../pages/lucky-coupon/lucky-coupon?hash=c6818e0a77e4e2f8365cc6ed1a93960827e43474'); |
| | | require('../../pages/assist-process/assist-process?hash=f1b7dc4ca438ceda80574161c70b1f25cb9fb567'); |
| | | require('../../pages/lucky-coupon/lucky-coupon?hash=f1b7dc4ca438ceda80574161c70b1f25cb9fb567'); |
| | | require('../../pages/msg-record/msg-record?hash=59bab5c4a4a4ec930e168925c97c3057ac83fa7d'); |
| | | require('../../pages/assist-friends/assist-friends?hash=59bab5c4a4a4ec930e168925c97c3057ac83fa7d'); |
| | | require('../../pages/msg-setting/msg-setting?hash=5f504890acbcf3bad0486fc198ac7448dd406718'); |
| | |
| | | |
| | | .btn-primary { |
| | | background: #0080FF; |
| | | color: white; |
| | | } |
| | | |
| | | .btn-ghost-hover { |
| | |
| | | var help = require('./util/help.js'); |
| | | var help = require('/util/help.js'); |
| | | var api = require('./util/api.js'); |
| | | const user = require('./util/user.js'); |
| | | App({ |
| | | themeColor: "#0080FF", |
| | | appKey: '1000001', |
| | | baseUrl:'http://192.168.3.122:8083', |
| | | version: 1, |
| | | logined: false, |
| | | baseUrl: 'http://192.168.3.122:8083', |
| | | onLaunch(options) { |
| | | |
| | | |
| | | // 第一次打开 |
| | | // options.query == {number:1} |
| | | console.info('App onLaunch'); |
| | | my.hideFavoriteMenu(); |
| | | |
| | | api.getConfig({ |
| | | success: function (res) { |
| | | if (res.code == 0) { |
| | | |
| | | //保存参数 |
| | | help.cacheConfig(res.data); |
| | | } |
| | | } |
| | | }); |
| | | user.init(); |
| | | }, |
| | | |
| | | |
| | | //全局分享函数 |
| | | onShareAppMessage(obj) { |
| | | |
| | | }, |
| | | |
| | | onShow(options) { |
| | | // 从后台被 scheme 重新打开 |
| | | // options.query == {number:1} |
| | |
| | | </view> |
| | | </view> |
| | | <view style="display:flex; justify-content: space-between;margin:60rpx 0 40rpx 0;"> |
| | | <button type="ghost" open-type="share" hover-class="btn-ghost-hover" onTap="onAssistClick" style="width:238rpx;"> |
| | | <button type="ghost" open-type="{{!logined?'getAuthorize':'share'}}" onGetAuthorize="onGetAuthorize" onError="onAuthError" scope='userInfo' hover-class="btn-ghost-hover" onTap="onAssistClick" style="width:238rpx;"> |
| | | 好友助力 |
| | | </button> |
| | | <button type="primary" class="btn-primary" hover-class="btn-primary-hover" onTap="{{activity.joined?'onMyCouponClick':'onFreeLuckyClick'}}" style="width:392rpx;"> |
| | | <button a:if="{{!logined}}" open-type="getAuthorize" onGetAuthorize="onGetAuthorize" onError="onAuthError" scope='userInfo' type="primary" class="btn-primary" hover-class="btn-primary-hover" style="width:392rpx;"> |
| | | {{activity.joined?'幸运券':'免费抽奖'}} |
| | | </button> |
| | | <button a:else type="primary" class="btn-primary" hover-class="btn-primary-hover" onTap="{{activity.joined?'onMyCouponClick':'onFreeLuckyClick'}}" style="width:392rpx;"> |
| | | {{activity.joined?'幸运券':'免费抽奖'}} |
| | | </button> |
| | | </view> |
| | |
| | | <view class="cut-line"></view> |
| | | <view onTap="mianZe">免责申明</view> |
| | | <view class="cut-line"></view> |
| | | <view onTap="onComplaintClick">我要投诉</view> |
| | | <view class="cut-line"></view> |
| | | <!--<view onTap="onComplaintClick">我要投诉</view><view class="cut-line"></view> --> |
| | | <view onTap="onMsgSettingClick">消息设置</view> |
| | | </view> |
| | | <view style="height:81rpx;"></view> |
| | |
| | | 免责申明 |
| | | </view> |
| | | <view class="content" decode="true"> |
| | | <text> |
| | | 我们天天领现金-淘拼团作为提供发起及参与抽奖的小程序平台,不对任何第三方发起人行为承担责任,活动中所包含的所有奖品均由活动发起者提供并发放。 |
| | | 我们天天领现金-淘拼团会在法律范围内规范、监督、督促用户遵守相关法律和平台使用规则,营造良好、公平、公正、真实的平台环境,感谢支持。 |
| | | <text decode="true"> |
| | | {{activity.disclaimers}} |
| | | </text> |
| | | </view> |
| | | <button type="primary" class="btn-primary" hover-class="btn-primary-hover" onTap="closeMianZeModal"> |
| | |
| | | var help = require('../../util/help.js'); |
| | | var api = require('../../util/api.js'); |
| | | var help = require('/util/help.js'); |
| | | var api = require('/util/api.js'); |
| | | import parse from 'mini-html-parser2'; |
| | | import user from '/util/user'; |
| | | var $this; |
| | | var leftTimeInterval; |
| | | Page({ |
| | | data: { |
| | | logined: getApp().logined, |
| | | leftTime: {//剩余时间 |
| | | hh: "00", |
| | | mm: "00", |
| | |
| | | leftTimeMS: 0, |
| | | checkFollow: false, |
| | | showFollow: false, |
| | | //关注条件结果 |
| | | joinConditionResult: {}, |
| | | //免责弹框 |
| | | showMianZeModal: false, |
| | | //参与抽奖成功弹框 |
| | |
| | | assistProcessDesc: [], |
| | | //中奖公示 |
| | | drawnAnouncementDesc: [], |
| | | |
| | | |
| | | }, |
| | | |
| | | onShareAppMessage() { |
| | |
| | | console.log(query); |
| | | help.setPageNavBar("抽奖详情"); |
| | | $this.setData({ |
| | | joinInfo: query.joinInfo |
| | | joinInfo: query.joinInfo, |
| | | logined:getApp().logined |
| | | }); |
| | | |
| | | api.getActivityDetail({ |
| | | showErrorToast: true, |
| | | showLoading: true, |
| | | id: query.id, |
| | | success: function (res) { |
| | | if (res.code != 0) { |
| | | my.showToast({ |
| | | content: res.msg |
| | | }); |
| | | return; |
| | | } |
| | | |
| | |
| | | }, 100); |
| | | |
| | | //封装助力进度的富文本 |
| | | $this.loadRichTextNode(help.getAssistProcessHtml(1), function (nodes) { |
| | | $this.loadRichTextNode(help.getAssistProcessHtml(data.assistCount), function (nodes) { |
| | | |
| | | $this.setData({ |
| | | assistProcessDesc: nodes |
| | |
| | | }); |
| | | |
| | | //封装中奖公示的富文本 |
| | | $this.loadRichTextNode(help.getDowanAnouncementHtml("2020.02.02 02:02"), function (nodes) { |
| | | $this.loadRichTextNode(help.getDowanAnouncementHtml(data.actualOpenDate), function (nodes) { |
| | | |
| | | $this.setData({ |
| | | drawnAnouncementDesc: nodes |
| | | }); |
| | | }); |
| | | // 是否需要展示关注组件 |
| | | switch ($this.data.activity.activity.sponsorAd.jump.jumpType) { |
| | | case 'alipayLife': //支付宝生活号 |
| | | $this.showFollowView(); |
| | | break; |
| | | } |
| | | } |
| | | |
| | | }, |
| | | showLoading: true, |
| | | }) |
| | | |
| | | |
| | |
| | | var item = my.createSelectorQuery() |
| | | .select('#beizhu'); |
| | | console.log(item); |
| | | |
| | | |
| | | |
| | | }, |
| | | |
| | | loadRichTextNode(html, callback) { |
| | |
| | | if (!err) { |
| | | callback(nodes); |
| | | } |
| | | }); |
| | | }, |
| | | //授权成功 |
| | | onGetAuthorize(res) { |
| | | user.login({ |
| | | success: function (data) { |
| | | $this.setData({ |
| | | logined: true, |
| | | user: data |
| | | }); |
| | | my.showToast({ |
| | | content: '登录成功' |
| | | }) |
| | | }, fail(e) { |
| | | my.showToast({ |
| | | content: '登录失败' |
| | | }) |
| | | } |
| | | }) |
| | | }, |
| | | //授权失败 |
| | | onAuthError(event) { |
| | | my.showToast({ |
| | | content: '授权失败' |
| | | }); |
| | | }, |
| | | |
| | |
| | | checkFollow: true, |
| | | showFollow: true |
| | | }); |
| | | |
| | | // setTimeout(() => { |
| | | // this.setData({ |
| | | // checkFollow: false, |
| | | // showFollow: true |
| | | // }); |
| | | |
| | | // }); |
| | | |
| | | }, |
| | | //关注回调 |
| | | checkFollowCb(e) { |
| | | // e.detail对象里会有followed字段,可以用来判断关注状态 |
| | | console.log("是否关注:" + e.detail.followed); |
| | | $this.data.joinConditionResult.attentioned = e.detail.followed; |
| | | this.setData({ |
| | | checkFollow: false, |
| | | showFollow: false, |
| | |
| | | }, |
| | | //关注面板关闭 |
| | | closeCb(e) { |
| | | $this.data.joinConditionResult.attentioned = e.detail.followed; |
| | | console.log("是否关注:" + e.detail.followed); |
| | | }, |
| | | //免费抽奖 |
| | | onFreeLuckyClick() { |
| | | //关闭助力弹框 |
| | | this.closeAssistModal(); |
| | | this.requestJoin(); |
| | | |
| | | var result = new Array(); |
| | | //获取参加条件 |
| | | console.log($this.data.activity.joinCondition.conditions); |
| | | for (var i = 0; i < $this.data.activity.joinCondition.conditions.length; i++) { |
| | | const key = $this.data.activity.joinCondition.conditions[i]; |
| | | console.log("key:" + key); |
| | | switch (key) { |
| | | case 'attention': |
| | | console.log("关注:" + $this.data.joinConditionResult.attentioned); |
| | | if ($this.data.joinConditionResult.attentioned) { |
| | | result.push(true); |
| | | } else { |
| | | result.push(false); |
| | | my.showToast({ |
| | | content: '请先关注生活号' |
| | | }); |
| | | return; |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | var canJoin = true; |
| | | if (result.length != 0) |
| | | for (var key in result) { |
| | | if (!key) { |
| | | canJoin = false; break; |
| | | } |
| | | } |
| | | if (canJoin) { |
| | | console.log("可以参与") |
| | | this.requestJoin(); |
| | | } |
| | | |
| | | }, |
| | | |
| | | //我的幸运券 |
| | | onMyCouponClick() { |
| | | my.navigateTo({ |
| | | url: '/pages/lucky-coupon/lucky-coupon?activityId='+$this.data.activity.activity.id |
| | | url: '/pages/lucky-coupon/lucky-coupon?activityId=' + $this.data.activity.activity.id |
| | | }); |
| | | }, |
| | | //更多参与者 |
| | | onJoinerMoreClick() { |
| | | my.navigateTo({ |
| | | url: '/pages/join-statistic/join-statistic' |
| | | url: '/pages/join-statistic/join-statistic?activityId=' + $this.data.activity.activity.id |
| | | }); |
| | | }, |
| | | |
| | | //助力进度 |
| | | onAssistProcessClick() { |
| | | my.navigateTo({ |
| | | url: '/pages/assist-process/assist-process' |
| | | url: '/pages/assist-process/assist-process?activityId=' + $this.data.activity.activity.id |
| | | }); |
| | | }, |
| | | |
| | | //中奖公示 |
| | | onDrawnAnouncementClick() { |
| | | my.navigateTo({ |
| | | url: '/pages/reward-announcement/reward-announcement' |
| | | url: '/pages/reward-announcement/reward-announcement?activityId=' + $this.data.activity.activity.id |
| | | }); |
| | | }, |
| | | |
| | |
| | | //参与抽奖 |
| | | requestJoin() { |
| | | api.joinLucky({ |
| | | showErrorToast: true, |
| | | activityId: this.data.activity.activity.id, |
| | | showLoading: true, |
| | | success: function (res) { |
| | |
| | | activity: activity |
| | | }); |
| | | |
| | | } else { |
| | | my.showToast({ |
| | | content: res.msg |
| | | }); |
| | | } |
| | | } |
| | | }) |
| | | }, |
| | | requestAssist() { |
| | | my.showToast({ |
| | | content: '助力信息:' + $this.data.joinInfo |
| | | }) |
| | | if (!$this.data.joinInfo) |
| | | return; |
| | | api.assist({ |
| | |
| | | <view> |
| | | <view class="body"> |
| | | <textarea maxlength="150" placeholder="你的意见很宝贵,感谢你的任何想法。"></textarea> |
| | | <button type="primary" class="btn-primary" hover-class="btn-primary-hover" onTap="onClick">确认反馈</button> |
| | | <form onSubmit="bindFormSubmit"> |
| | | <textarea maxlength="150" name="content" placeholder="你的意见很宝贵,感谢你的任何想法。"></textarea> |
| | | <button form-type="submit" type="primary" class="btn-primary" hover-class="btn-primary-hover">确认反馈</button> |
| | | </form> |
| | | |
| | | </view> |
| | | </view> |
| | |
| | | var help = require("../../util/help.js"); |
| | | var help = require('/util/help.js'); |
| | | const api = require("/util/api.js"); |
| | | |
| | | Page({ |
| | | data: {}, |
| | | onLoad() { |
| | | help.setPageNavBar("意见反馈"); |
| | | }, |
| | | onClick(){ |
| | | bindFormSubmit(e) { |
| | | const content = e.detail.value.content; |
| | | if (help.isNullOrEmpty(content)) { |
| | | my.showToast({ |
| | | content: '请填写意见' |
| | | }); |
| | | return; |
| | | } |
| | | |
| | | |
| | | my.getStorage({ |
| | | key: 'advice_time', |
| | | success: (result) => { |
| | | if (result.data == null || result.data < new Date().getTime()) { |
| | | api.advice({ |
| | | showErrorToast: true, |
| | | showLoading: true, |
| | | content: content, |
| | | success: function (res) { |
| | | if (res.code == 0) { |
| | | my.showToast({ |
| | | content: '提交成功' |
| | | }); |
| | | my.setStorage({ |
| | | key: 'advice_time', |
| | | data: new Date().getTime()+1000*60*5 |
| | | }); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | } else { |
| | | my.showToast({ |
| | | content: '请稍后再试' |
| | | }); |
| | | } |
| | | }, |
| | | fail: () => { |
| | | |
| | | }, |
| | | complete: () => { |
| | | |
| | | } |
| | | }); |
| | | |
| | | } |
| | | }); |
| | |
| | | 成功助力你 |
| | | </view> |
| | | </flex> |
| | | <scroll-view scroll-y> |
| | | <scroll-view a:if="{{!showEmptyDefault&&list.length>0}}" scroll-y onScrollToLower="scrollMytrip" enable-back-to-top="true"> |
| | | <view a:for="{{userList}}"> |
| | | <flex class="item" justify="between"> |
| | | <flex> |
| | |
| | | </view> |
| | | </flex> |
| | | </view> |
| | | <!-- 上拉加载 --> |
| | | <include src="../loading_view.axml" /> |
| | | <template is="page-footer" data="{{showFooter}}"/> |
| | | </scroll-view> |
| | | <import src="../template/template.axml"/> |
| | | <template a:if="{{showEmptyDefault}}" is="page-result-empty" data="{{title:'亲,暂无数据哦'}}"/> |
| | | </view> |
| | | </view> |
| | |
| | | var help = require('/util/help.js'); |
| | | var api = require('/util/api.js'); |
| | | var $this; |
| | | Page({ |
| | | data: { |
| | | userList:[{},{},{}], |
| | | showLoading:true |
| | | /* 列表数据开始 */ |
| | | list: [], |
| | | showLoading: false, |
| | | page: 1, |
| | | total: 0, |
| | | showEmptyDefault: false, |
| | | isRequesting: false,//是否正在请求中 |
| | | showFooter: false, |
| | | /* 列表数据结束 */ |
| | | }, |
| | | onLoad() { |
| | | my.setNavigationBar({ |
| | | title: "助力好友", |
| | | backgroundColor: "#0080FF", |
| | | borderBottomColor: "#0080FF" |
| | | help.setPageNavBar("助力好友"); |
| | | $this = this; |
| | | $this.requestAssistFriendsList(1, true); |
| | | }, |
| | | |
| | | |
| | | onPullDownRefresh() { |
| | | console.log('onPullDownRefresh', new Date()); |
| | | my.showToast({ |
| | | content: "下拉刷新触发" |
| | | }); |
| | | this.requestAssistFriendsList(1); |
| | | }, |
| | | //请求活动 |
| | | requestAssistFriendsList(page, first) { |
| | | $this.setData({ |
| | | page: page, |
| | | isRequesting: true, |
| | | showEmptyDefault:false |
| | | }); |
| | | api.getAssistFriendsList({ |
| | | page: page, |
| | | showErrorToast: true, |
| | | showLoading: first, |
| | | success: function (res) { |
| | | console.log(res) |
| | | if (res.code == 0) { |
| | | var list = res.data.data; |
| | | //设置列表数据 |
| | | if (list != null && list.length > 0) { |
| | | var totalList = $this.data.list.concat(list); |
| | | if (page == 1) { |
| | | totalList = list; |
| | | } |
| | | $this.setData({ |
| | | total: res.data.count, |
| | | list: totalList, |
| | | showFooter: totalList.length >= res.data.count |
| | | }) |
| | | } |
| | | //设置空列表默认显示 |
| | | if (page == 1 && (list == null || list.length == 0)) { |
| | | $this.setData({ |
| | | showEmptyDefault: true |
| | | }) |
| | | } |
| | | } |
| | | }, |
| | | fail: function () { |
| | | //请求失败需要将页码减1 |
| | | if ($this.data.page > 1) { |
| | | $this.setData({ |
| | | page: $this.data.page - 1 |
| | | }); |
| | | } |
| | | }, |
| | | complete: function () { |
| | | my.stopPullDownRefresh(); |
| | | setTimeout(() => { |
| | | $this.setData({ |
| | | isRequesting: false, |
| | | showLoading: false |
| | | }); |
| | | }, 1000); |
| | | |
| | | } |
| | | }); |
| | | |
| | | }, |
| | | //到达底部 |
| | | async scrollMytrip() { |
| | | if (this.data.isRequesting) |
| | | return; |
| | | try { |
| | | console.log('scrollMytrip:'); |
| | | const { page, list, } = this.data; |
| | | // 判断是否还有数据需要加载 |
| | | if (list.length < this.data.total) { |
| | | //开启加载 |
| | | this.setData({ showLoading: true }); |
| | | const newPage = page + 1; |
| | | $this.requestAssistFriendsList(newPage); |
| | | } |
| | | } catch (e) { |
| | | this.setData({ showLoading: false }); |
| | | console.log('scrollMytrip执行异常:', e); |
| | | } |
| | | }, |
| | | |
| | | }); |
| | |
| | | <view class="column2">状态</view> |
| | | <view class="column3">获得幸运券</view> |
| | | </flex> |
| | | <scroll-view scroll-y style="height:100%;"> |
| | | <flex class="item" direction="row" align="center" wrap="nowrap" a:for="{{friendsList}}"> |
| | | <scroll-view scroll-y style="height:100%;" onScrollToLower="scrollMytrip"> |
| | | <flex class="item" direction="row" align="center" wrap="nowrap" a:for="{{list}}"> |
| | | <flex class="column1" direction="row" wrap="wrap"> |
| | | <image mode="scaleToFill" src="/image/portrait-test.jpg"/> |
| | | <image mode="scaleToFill" src="{{item.user.portrait}}"/> |
| | | <view> |
| | | <text number-of-lines="1">获得幸运券hellow 你好请问</text> |
| | | <text number-of-lines="1">{{item.user.nickName}}</text> |
| | | </view> |
| | | |
| | | </flex> |
| | | <text class="column2">助力成功\n且参与抽奖</text> |
| | | <text class="column3">+ 12张</text> |
| | | <text class="column2">{{item.state}}</text> |
| | | <text class="column3">+ {{item.count}}张</text> |
| | | </flex> |
| | | <include src="../loading_view.axml" /> |
| | | <template is="page-footer" data="{{showFooter}}"/> |
| | | </scroll-view> |
| | | <import src="../template/template.axml"/> |
| | | <template a:if="{{showEmptyDefault}}" is="page-result-empty" data="{{title:'亲,暂无数据哦'}}"/> |
| | | </view> |
| | | </view> |
| | |
| | | var help = require('../../util/help.js'); |
| | | var help = require('/util/help.js'); |
| | | var api = require('/util/api.js'); |
| | | var $this; |
| | | Page({ |
| | | data: { |
| | | friendsList: [{}, {}, {},{}, {}], |
| | | showLoading: true |
| | | /* 列表数据开始 */ |
| | | list: [], |
| | | showLoading: false, |
| | | page: 1, |
| | | total: 0, |
| | | showEmptyDefault: false, |
| | | isRequesting: false,//是否正在请求中 |
| | | showFooter: false, |
| | | /* 列表数据结束 */ |
| | | }, |
| | | |
| | | onLoad() { |
| | | onLoad(query) { |
| | | help.setPageNavBar("助力进度"); |
| | | console.log(query) |
| | | $this = this; |
| | | var activityId = query.activityId; |
| | | $this.data.activityId = activityId; |
| | | $this.getActivityAssistCouponList(1,true); |
| | | }, |
| | | onPullDownRefresh() { |
| | | console.log('onPullDownRefresh', new Date()); |
| | | my.showToast({ |
| | | content: "下拉刷新触发" |
| | | }); |
| | | this.getActivityAssistCouponList(1); |
| | | }, |
| | | //请求活动 |
| | | getActivityAssistCouponList(page, first) { |
| | | $this.setData({ |
| | | page: page, |
| | | isRequesting: true, |
| | | showEmptyDefault: false |
| | | }); |
| | | api.getActivityAssistCouponList({ |
| | | activityId: $this.data.activityId, |
| | | page: page, |
| | | showLoading: first, |
| | | success: function (res) { |
| | | console.log(res) |
| | | if (res.code == 0) { |
| | | var list = res.data.data; |
| | | //设置列表数据 |
| | | if (list != null && list.length > 0) { |
| | | var totalList = $this.data.list.concat(list); |
| | | if (page == 1) { |
| | | totalList = list; |
| | | } |
| | | $this.setData({ |
| | | total: res.data.count, |
| | | list: totalList, |
| | | showFooter: totalList.length >= res.data.count |
| | | }) |
| | | } |
| | | //设置空列表默认显示 |
| | | if (page == 1 && (list == null || list.length == 0)) { |
| | | $this.setData({ |
| | | showEmptyDefault: true |
| | | }) |
| | | } |
| | | } else { |
| | | my.showToast({ |
| | | content: res.msg |
| | | }); |
| | | } |
| | | }, |
| | | fail: function () { |
| | | //请求失败需要将页码减1 |
| | | if ($this.data.page > 1) { |
| | | $this.setData({ |
| | | page: $this.data.page - 1 |
| | | }); |
| | | } |
| | | }, |
| | | complete: function () { |
| | | my.stopPullDownRefresh(); |
| | | setTimeout(() => { |
| | | $this.setData({ |
| | | isRequesting: false, |
| | | showLoading: false |
| | | }); |
| | | }, 1000); |
| | | |
| | | } |
| | | }); |
| | | }, |
| | | |
| | | //到达底部 |
| | | async scrollMytrip() { |
| | | if (this.data.isRequesting) |
| | | return; |
| | | try { |
| | | console.log('scrollMytrip:'); |
| | | const { page, list, } = this.data; |
| | | // 判断是否还有数据需要加载 |
| | | if (list.length < this.data.total) { |
| | | //开启加载 |
| | | this.setData({ showLoading: true }); |
| | | const newPage = page + 1; |
| | | $this.getActivityAssistCouponList(newPage); |
| | | } |
| | | } catch (e) { |
| | | this.setData({ showLoading: false }); |
| | | console.log('scrollMytrip执行异常:', e); |
| | | } |
| | | }, |
| | | }); |
| | |
| | | font-weight: 400; |
| | | font-size: 24rpx; |
| | | margin-top: 29rpx; |
| | | margin-bottom: 18rpx; |
| | | |
| | | } |
| | | |
| | | .body .content-rank .title { |
| | |
| | | <view class="column4">中奖概率</view> |
| | | </flex> |
| | | <scroll-view scroll-y> |
| | | <view class="notify"> |
| | | <view class="notify" a:if="{{!myRank}}"> |
| | | 你未能入榜,赶快去邀请好友助力提高中奖概率 |
| | | </view> |
| | | <flex class="item {{index==0?'active':''}}" a:for="{{rankList}}" direction="row" wrap="nowrap"> |
| | | <flex class="column1" justify="center"> |
| | | <image a:if="{{item.rank<4}}" mode="scaleToFill" src="/image/icon/icon_rank_{{item.rank}}.png"/> |
| | | <text a:else>1888</text> |
| | | <view style="height:18rpx;"> |
| | | </view> |
| | | <view a:for="{{rankList}}" data-item="{{item}}" onTap="onRankClick"> |
| | | <flex class="item {{item.myRank?'active':''}}" direction="row" wrap="nowrap"> |
| | | <flex class="column1" justify="center"> |
| | | <image a:if="{{item.rank<4}}" mode="scaleToFill" src="/image/icon/icon_rank_{{item.rank}}.png"/> |
| | | <text a:else>{{item.rank}}</text> |
| | | </flex> |
| | | <flex class="column2" wrap="nowrap" align="center"> |
| | | <image mode="scaleToFill" src="{{item.user.portrait}}"/> |
| | | <text number-of-lines="1">{{item.user.nickName}}</text> |
| | | </flex> |
| | | <view class="column3"> ×{{item.count}}张</view> |
| | | <flex class="column4" justify="center"> |
| | | <image mode="scaleToFill" src="/image/icon/icon_statistic_detail.png"/> |
| | | </flex> |
| | | </flex> |
| | | <flex class="column2" wrap="nowrap" align="center"> |
| | | <image mode="scaleToFill" src="/image/portrait-test.jpg"/> |
| | | <text number-of-lines="1">红袖添香</text> |
| | | </flex> |
| | | <view class="column3"> ×12张</view> |
| | | <flex class="column4" justify="center"> |
| | | <image mode="scaleToFill" src="/image/icon/icon_statistic_detail.png"/> |
| | | </flex> |
| | | </flex> |
| | | <view class="footer"> |
| | | </view> |
| | | <view class="footer" a:if="{{rankList.length>0}}"> |
| | | 注:仅展示前10参与者 |
| | | </view> |
| | | </scroll-view> |
| | | |
| | | </view> |
| | | <!--全部参与者--> |
| | | <view class="content-joiner" a:if="{{currentType==2}}"> |
| | | <flex class="title" direction="row" justify="between" wrap="wrap"> |
| | | <view class="placeholder">共12834参与</view> |
| | | <view class="placeholder">你是第1002参与</view> |
| | | <flex class="title" direction="row" justify="between" wrap="wrap" a:if="{{statistic}}"> |
| | | <view class="placeholder">共{{statistic.totalJoiner}}参与</view> |
| | | <view class="placeholder">你是第{{statistic.myPosition}}参与</view> |
| | | </flex> |
| | | <scroll-view scroll-y style="height:100%;"> |
| | | <flex class="joiner-list" direction="row" wrap="wrap"> |
| | | <image style="margin-right:{{(index+1)%10!=0?'4rpx;':'0;'}} margin-top:{{(index+1)>10?'4rpx;':'0;'}}" mode="scaleToFill" src="/image/portrait-test.jpg" a:for="{{joinerList}}"/> |
| | | <image style="margin-right:{{(index+1)%10!=0?'4rpx;':'0;'}} margin-top:{{(index+1)>10?'4rpx;':'0;'}}" mode="scaleToFill" src="{{item.portrait}}" a:for="{{joinerList}}"/> |
| | | </flex> |
| | | <view class="load-more" a:if="{{joinerHasMore}}" onTap="onMoreJoiner"> |
| | | 加载更多 |
| | |
| | | 注:参与先后顺序与中奖概率无关 |
| | | </view> |
| | | </scroll-view> |
| | | <import src="../template/template.axml"/> |
| | | <template a:if="{{showEmptyDefault}}" is="page-result-empty" data="{{title:'亲,暂无数据哦'}}"/> |
| | | </view> |
| | | </view> |
| | | <modal class="statistic-modal" show="{{showStatistic}}" onModalClose="onStatisticClose" advice="{{true}}"> |
| | | <view class="model-content"> |
| | | <text class="title">当前中奖概率高于平均值</text> |
| | | <view class="number"> |
| | | <image src="/image/icon/icon_percent_up.png"/> |
| | | <image src="/image/icon/icon_percent_up.png" a:if="{{probability.offset>0}}"/> |
| | | <image src="/image/icon/icon_percent_down.png" a:elif="{{probability.offset<0}}"/> |
| | | <image src="/image/icon/icon_percent_equal.png" a:else/> |
| | | <view> |
| | | <text class="percent">10.05倍</text> |
| | | <text class="percent">{{probability.offset}}倍</text> |
| | | </view> |
| | | </view> |
| | | <view style="display:flex; justify-content: center; margin-bottom: 30rpx;"> |
| | | <circle-statistic-view percent="50" width="184rpx" height="184rpx"></circle-statistic-view> |
| | | <circle-statistic-view percent="{{probability.percent}}" width="184rpx" height="184rpx"></circle-statistic-view> |
| | | </view> |
| | | <text> |
| | | |
| | | 注:当前平均中奖概率是12.00%,\n |
| | | 平均概率为12.00% |
| | | 注:当前平均中奖概率是{{probability.average}}% |
| | | </text> |
| | | </view> |
| | | </modal> |
| | |
| | | var help = require('../../util/help.js'); |
| | | var help = require('/util/help.js'); |
| | | var api = require('/util/api.js'); |
| | | var $this; |
| | | Page({ |
| | | data: { |
| | | showStatistic: true, |
| | | showStatistic: false, |
| | | currentType: 1, |
| | | showLoading: true, |
| | | rankList: [{ rank: 1 }, { rank: 3 }, {}, {}, {}], |
| | | joinerList: [{}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}], |
| | | rankList: [], |
| | | myRank: true, |
| | | |
| | | //参与者 |
| | | joinerList: [], |
| | | page: 1, |
| | | total: 0, |
| | | joinerHasMore: true |
| | | }, |
| | | onLoad() { |
| | | onLoad(query) { |
| | | |
| | | $this = this; |
| | | help.setPageNavBar("参与统计"); |
| | | this.setData({ |
| | | activityId: query.activityId |
| | | }); |
| | | setTimeout(() => { |
| | | $this.requestRank(); |
| | | }); |
| | | }, |
| | | changeNav(event) { |
| | | var type = help.getEventParam(event, "type"); |
| | |
| | | this.setData({ |
| | | currentType: type |
| | | }); |
| | | |
| | | switch (type) { |
| | | case 1: |
| | | $this.requestRank(); |
| | | break; |
| | | case 2: |
| | | $this.requestJoinerList(1, true) |
| | | break; |
| | | } |
| | | |
| | | }, |
| | | onMoreJoiner() { |
| | | console.log("加载更多参与者信息"); |
| | | $this.requestJoinerList($this.data.page + 1, false); |
| | | }, |
| | | onStatisticClose() { |
| | | this.setData({ |
| | | showStatistic: false |
| | | }); |
| | | }, |
| | | onRankClick(event) { |
| | | |
| | | var data = help.getEventParam(event, "item"); |
| | | console.log(data); |
| | | $this.requestProbability(data.user.uid); |
| | | }, |
| | | requestRank() { |
| | | api.getRankList({ |
| | | showErrorToast: true, |
| | | showLoading: true, |
| | | page: 1, |
| | | activityId: $this.data.activityId, |
| | | success: function (res) { |
| | | if (res.code == 0) { |
| | | var list = res.data.data; |
| | | if (res.data.myRank) { |
| | | res.data.myRank.myRank = true; |
| | | list.unshift(res.data.myRank); |
| | | } |
| | | |
| | | |
| | | $this.setData({ |
| | | myRank: res.data.myRank != null, |
| | | rankList: list |
| | | }); |
| | | |
| | | console.log("myRank:" + (res.data.myRank != null)) |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | | }); |
| | | }, |
| | | requestProbability(uid) { |
| | | api.getProbability({ |
| | | showErrorToast: true, |
| | | showLoading: true, |
| | | activityId: $this.data.activityId, |
| | | targetUid: uid, |
| | | success: function (res) { |
| | | if (res.code == 0) { |
| | | $this.setData({ |
| | | probability: res.data |
| | | }); |
| | | setTimeout(() => { |
| | | $this.setData({ |
| | | showStatistic: true |
| | | }); |
| | | }); |
| | | } |
| | | } |
| | | }) |
| | | }, |
| | | requestJoinerList(page, first) { |
| | | $this.setData({ |
| | | page: page, |
| | | isRequesting: true, |
| | | showEmptyDefault: false |
| | | }); |
| | | api.getJoinerList({ |
| | | activityId: $this.data.activityId, |
| | | page: page, |
| | | showErrorToast: true, |
| | | showLoading: first, |
| | | success: function (res) { |
| | | console.log(res) |
| | | if (res.code == 0) { |
| | | var list = res.data.data; |
| | | //设置列表数据 |
| | | if (list != null && list.length > 0) { |
| | | var totalList = $this.data.joinerList.concat(list); |
| | | if (page == 1) { |
| | | totalList = list; |
| | | } |
| | | $this.setData({ |
| | | total: res.data.count, |
| | | joinerList: totalList, |
| | | joinerHasMore: totalList.length < res.data.count |
| | | }) |
| | | } |
| | | //设置空列表默认显示 |
| | | if (page == 1 && (list == null || list.length == 0)) { |
| | | $this.setData({ |
| | | showEmptyDefault: true |
| | | }) |
| | | } |
| | | } |
| | | }, |
| | | fail: function () { |
| | | //请求失败需要将页码减1 |
| | | if ($this.data.page > 1) { |
| | | $this.setData({ |
| | | page: $this.data.page - 1 |
| | | }); |
| | | } |
| | | }, |
| | | complete: function () { |
| | | setTimeout(() => { |
| | | $this.setData({ |
| | | isRequesting: false |
| | | }); |
| | | }, 1000); |
| | | } |
| | | }); |
| | | |
| | | |
| | | |
| | | } |
| | | }); |
| | |
| | | var help = require('../../util/help.js'); |
| | | var api = require('../../util/api.js'); |
| | | var help = require('/util/help.js'); |
| | | var api = require('/util/api.js'); |
| | | var $this; |
| | | Page({ |
| | | data: { |
| | |
| | | api.getLuckyCouponList({ |
| | | activityId: $this.data.activityId, |
| | | page: page, |
| | | showErrorToast: true, |
| | | showLoading: first, |
| | | success: function (res) { |
| | | console.log(res) |
| | |
| | | showEmptyDefault: true |
| | | }) |
| | | } |
| | | } else { |
| | | my.showToast({ |
| | | content: res.msg |
| | | }); |
| | | } |
| | | }, |
| | | fail: function () { |
| | |
| | | var help = require('../../util/help.js'); |
| | | var api = require('../../util/api.js'); |
| | | var help = require('/util/help.js'); |
| | | var api = require('/util/api.js'); |
| | | var $this; |
| | | Page({ |
| | | data: { |
| | |
| | | $this.setData({ |
| | | page: page, |
| | | isRequesting: true, |
| | | showEmptyDefault:false |
| | | showEmptyDefault: false |
| | | }); |
| | | api.getLuckyRecord({ |
| | | page: page, |
| | | type: $this.data.type, |
| | | showErrorToast: true, |
| | | showLoading: first, |
| | | success: function (res) { |
| | | console.log(res) |
| | |
| | | showEmptyDefault: true |
| | | }) |
| | | } |
| | | } else { |
| | | my.showToast({ |
| | | content: res.msg |
| | | }); |
| | | } |
| | | }, |
| | | fail: function () { |
| | |
| | | } |
| | | this.setData({ |
| | | type: newType, |
| | | list:[], |
| | | total:0 |
| | | list: [], |
| | | total: 0 |
| | | }); |
| | | this.requestActivity(1, true); |
| | | } |
| | |
| | | </flex> |
| | | <flex a:else class="user" align="center" a:if="{{logined}}"> |
| | | <image mode="scaleToFill" class="portrait" src="/image/portrait-test.jpg"/> |
| | | <button type="ghost" class="login" open-type="getAuthorize" onGetAuthorize="onGetAuthorize" onError="onAuthError" scope='userInfo'> |
| | | <button type="ghost" class="login" open-type="{{!logined?'getAuthorize':''}}" onGetAuthorize="onGetAuthorize" onError="onAuthError" scope='userInfo'> |
| | | 登录 |
| | | </button> |
| | | </flex> |
| | |
| | | <view style="height:22rpx;"></view> |
| | | <list-item thumb="/image/icon/icon_mine_msg.png" arrow="{{true}}" thumbSize="48rpx" data-key="msg" onClick="onItemClick"> |
| | | 消息记录 |
| | | <badge className="badge" slot="extra" text="{{'99+'}}" dot="{{false}}" /> |
| | | <badge className="badge" slot="extra" a:if="{{}}" text="{{msgCount}}" dot="{{false}}" /> |
| | | </list-item> |
| | | <view style="height:22rpx;"></view> |
| | | <list-item thumb="/image/icon/icon_mine_scan_history.png" arrow="{{true}}" thumbSize="53rpx" data-key="scanHistory" onClick="onItemClick"> |
| | |
| | | var help = require('../../util/help.js'); |
| | | var api = require('../../util/api.js'); |
| | | var help = require('/util/help.js'); |
| | | var api = require('/util/api.js'); |
| | | const user = require('/util/user'); |
| | | var $this; |
| | | Page({ |
| | | data: { |
| | | showLogout: false |
| | | showLogout: false, |
| | | logined: false |
| | | }, |
| | | |
| | | //导航栏点击过来的 |
| | | onTabItemTap(item) { |
| | | my.getAuthCode({ |
| | | scopes: ['auth_user'], |
| | | success: (res) => { |
| | | my.getOpenUserInfo({ |
| | | fail: (res) => { |
| | | }, |
| | | success: (res) => { |
| | | |
| | | console.log(res); |
| | | let userInfo = JSON.parse(res.response).response // 以下方的报文格式解析两层 response |
| | | console.log(userInfo); |
| | | } |
| | | user.getUserInfo({ |
| | | success(data) { |
| | | $this.setData({ |
| | | logined: true, |
| | | user: data |
| | | }); |
| | | }, |
| | | }); |
| | | } |
| | | |
| | | }) |
| | | }, |
| | | onLoad() { |
| | | my.setNavigationBar({ |
| | | backgroundColor: "#0080FF", |
| | | borderBottomColor: "#0080FF" |
| | | $this = this; |
| | | help.setPageNavBar(null); |
| | | my.getStorage({ key: 'user' }, function (res) { |
| | | var user = res.data; |
| | | console.log(user) |
| | | if (user != null) { |
| | | $this.setData({ |
| | | logined: true, |
| | | user: user |
| | | }); |
| | | } |
| | | }); |
| | | |
| | | |
| | | let userData = my.getStorageSync({ key: 'user' }); |
| | | var user = userData.data; |
| | | console.log(user) |
| | | if (user != null) { |
| | | this.setData({ |
| | | logined: true, |
| | | user: user |
| | | }); |
| | | } |
| | | |
| | | $this.requestGetUserConfig(); |
| | | }, |
| | | |
| | | onGetAuthorize(res) { |
| | | var that = this; |
| | | my.getOpenUserInfo({ |
| | | fail: (res) => { |
| | | }, |
| | | success: (res) => { |
| | | let userInfo = JSON.parse(res.response).response // 以下方的报文格式解析两层 response |
| | | if (userInfo.code == '10000') {//成功 |
| | | console.log(JSON.stringify(userInfo)) |
| | | help.rsa(JSON.stringify(userInfo), function (res) { |
| | | api.uploadUserInfo({ |
| | | userInfo: res, |
| | | showLoading: true, |
| | | success: function (res) { |
| | | if (res.code == 0) { |
| | | that.setData({ |
| | | logined: true, |
| | | user: res.data |
| | | }); |
| | | |
| | | //保存用户信息 |
| | | my.setStorage({ |
| | | key: 'user', |
| | | data: res.data |
| | | }); |
| | | |
| | | } else { |
| | | my.showToast({ |
| | | content: res.msg |
| | | }) |
| | | } |
| | | } |
| | | }) |
| | | }); |
| | | } else { |
| | | my.showToast({ |
| | | content: '授权失败' |
| | | }); |
| | | } |
| | | user.login({ |
| | | success: function (data) { |
| | | $this.setData({ |
| | | logined: true, |
| | | user: data |
| | | }); |
| | | }, fail(e) { |
| | | my.showToast({ |
| | | content: '登录失败' |
| | | }) |
| | | } |
| | | }); |
| | | }) |
| | | }, |
| | | onAuthError(event) { |
| | | my.showToast({ |
| | |
| | | case 'scanHistory': |
| | | path = '/pages/scan-record/scan-record'; |
| | | break; |
| | | case 'newerCourse': break; |
| | | case 'newerCourse': |
| | | help.getCachedConfig(function (params) { |
| | | if (params && params.newerCourse) { |
| | | path = '/pages/web/web?title=新手教程&url=' + params.newerCourse; |
| | | my.navigateTo({ |
| | | url: path |
| | | }); |
| | | return; |
| | | } |
| | | }); |
| | | |
| | | break; |
| | | case 'question': |
| | | path = '/pages/web/web?title=测试&url=http://www.baidu.com'; |
| | | help.getCachedConfig(function (params) { |
| | | if (params && params.commonQuestion) { |
| | | path = '/pages/web/web?title=常见问题&url=' + params.commonQuestion; |
| | | my.navigateTo({ |
| | | url: path |
| | | }); |
| | | return; |
| | | } |
| | | |
| | | |
| | | |
| | | }); |
| | | break; |
| | | } |
| | | my.navigateTo({ |
| | | url: path |
| | | }); |
| | | }, |
| | | |
| | | requestGetUserConfig() { |
| | | api.getUserConfig({ |
| | | success: function (res) { |
| | | if (res.code == 0) { |
| | | $this.setData({ |
| | | msgCount: res.data.msgCount |
| | | }); |
| | | |
| | | } |
| | | } |
| | | }) |
| | | |
| | | }, |
| | | |
| | | //关闭退出弹框 |
| | | onCloseLogout() { |
| | | this.setData({ |
| | |
| | | }); |
| | | }, |
| | | onLogout() { |
| | | this.setData({ |
| | | user: null, |
| | | logined: false |
| | | |
| | | user.logout({ |
| | | success() { |
| | | $this.setData({ |
| | | user: null, |
| | | logined: false |
| | | }); |
| | | $this.onCloseLogout(); |
| | | }, |
| | | fail() { |
| | | my.showToast({ |
| | | content: '退出登录失败' |
| | | }); |
| | | } |
| | | }); |
| | | this.onCloseLogout(); |
| | | |
| | | }, |
| | | onCloseLogoutShow() { |
| | | this.setData({ |
| | |
| | | <view> |
| | | <flex class="msg-nav" justify="center" align="center"> |
| | | <image mode="scaleToFill" src="/image/icon/icon_clear_msg.png"/> |
| | | <view> |
| | | <view onTap="onClearUnRead"> |
| | | 消息全部已读 |
| | | </view> |
| | | </flex> |
| | | <scroll-view scroll-y> |
| | | <view a:for="{{msgList}}" class="item"> |
| | | <scroll-view a:if="{{!showEmptyDefault&&list.length>0}}" scroll-y onScrollToLower="scrollMytrip" enable-back-to-top="true"> |
| | | <view a:for="{{list}}" class="item"> |
| | | <flex class="header"> |
| | | <image class="msg-icon" src="/image/portrait-test.jpg"/> |
| | | <view class="msg-type">抽奖消息 |
| | | <image class="msg-icon" src="{{item.icon}}"/> |
| | | <view class="msg-type">{{item.name}} |
| | | </view> |
| | | <view class="time">3分钟前 |
| | | <view class="time">{{item.time}} |
| | | </view> |
| | | </flex> |
| | | <view class="body"> |
| | | <flex class="row" justify="between" align="top" a:for="{{item.contentList}}"> |
| | | <flex class="row" justify="between" align="top" a:for-item="content" a:for="{{item.contentList}}"> |
| | | <view class="title"> |
| | | {{item.title}} |
| | | {{content.title}} |
| | | </view> |
| | | <rich-text class="content" nodes=" {{item.content}}" onTap="tap"></rich-text> |
| | | </flex> |
| | | </view> |
| | | </view> |
| | | <include src="../loading_view.axml" /> |
| | | <template is="page-footer" data="{{showFooter}}"/> |
| | | </scroll-view> |
| | | <import src="../template/template.axml"/> |
| | | <template a:if="{{showEmptyDefault}}" is="page-result-empty" data="{{title:'亲,暂无数据哦'}}"/> |
| | | </view> |
| | |
| | | var help = require('/util/help.js'); |
| | | var api = require('/util/api.js'); |
| | | var $this; |
| | | Page({ |
| | | data: { |
| | | showLoading: true, |
| | | msgList: [{ |
| | | contentList: [{ |
| | | title: "开奖期数", content: [{ |
| | | name: 'div', |
| | | children: [{ |
| | | type: 'text', |
| | | text: 'Hello World!Hello World!Hello World!Hello World!Hello World!', |
| | | }, |
| | | { |
| | | name: 'img', |
| | | attrs: { |
| | | src: 'https://gw.alicdn.com/tps/i3/TB1yeWeIFXXXXX5XFXXuAZJYXXX-210-210.png_160x160.jpg', |
| | | style: 'border-radius:50%;width:30rpx;margin-left:5rpx;' |
| | | } |
| | | }, |
| | | { |
| | | name: 'a', |
| | | attrs: { |
| | | href: 'https://www.baidu.com', |
| | | style: 'color:#0080FF;' |
| | | }, |
| | | children: [{ |
| | | type: 'text', |
| | | text: '查看详情' |
| | | }] |
| | | } |
| | | ], |
| | | }], |
| | | }, {}, {}, {}] |
| | | }, {}, {}] |
| | | /* 列表数据开始 */ |
| | | list: [], |
| | | showLoading: false, |
| | | page: 1, |
| | | total: 0, |
| | | showEmptyDefault: false, |
| | | isRequesting: false,//是否正在请求中 |
| | | showFooter: false, |
| | | /* 列表数据结束 */ |
| | | }, |
| | | onLoad() { |
| | | my.setNavigationBar({ |
| | | title: "消息记录", |
| | | backgroundColor: "#0080FF", |
| | | borderBottomColor: "#0080FF" |
| | | help.setPageNavBar("消息记录"); |
| | | $this = this; |
| | | }, |
| | | onPullDownRefresh() { |
| | | console.log('onPullDownRefresh', new Date()); |
| | | my.showToast({ |
| | | content: "下拉刷新触发" |
| | | }); |
| | | this.requestUserMsgList(1); |
| | | }, |
| | | |
| | | /** |
| | | * 转为为富文本数据 |
| | | * @param {*} list |
| | | * @param {*} callback |
| | | */ |
| | | convertToRichText(list, callback) { |
| | | for (var i = 0; i < list.length; i++) { |
| | | for (var j = 0; j < list[i].contentList.length; j++) { |
| | | help.loadRichTextNode(list[i].contentList[j].content, function (res) { |
| | | list[i].contentList[j].content = res; |
| | | if (i == list.length - 1 && j == list[i].contentList.length) { |
| | | callback(list); |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | }, |
| | | |
| | | /** |
| | | * 清除未读消息 |
| | | */ |
| | | onClearUnRead() { |
| | | $this.requestSetMsgRead(); |
| | | }, |
| | | |
| | | /** |
| | | * 设置消息已读 |
| | | */ |
| | | requestSetMsgRead() { |
| | | api.setMsgRead({ |
| | | showErrorToast: true, |
| | | showLoading: true, |
| | | success: function (res) { |
| | | if (res.code == 0) { |
| | | my.showToast({ |
| | | content: '清除成功' |
| | | }) |
| | | } |
| | | } |
| | | |
| | | }); |
| | | |
| | | }, |
| | | //请求活动 |
| | | requestUserMsgList(page, first) { |
| | | $this.setData({ |
| | | page: page, |
| | | isRequesting: true, |
| | | showEmptyDefault: false |
| | | }); |
| | | api.getUserMsgList({ |
| | | page: page, |
| | | showErrorToast: true, |
| | | showLoading: first, |
| | | success: function (res) { |
| | | console.log(res) |
| | | if (res.code == 0) { |
| | | var list = res.data.data; |
| | | //数据预处理 |
| | | $this.convertToRichText(list, function (list) { |
| | | //设置列表数据 |
| | | if (list != null && list.length > 0) { |
| | | var totalList = $this.data.list.concat(list); |
| | | if (page == 1) { |
| | | totalList = list; |
| | | } |
| | | $this.setData({ |
| | | total: res.data.count, |
| | | list: totalList, |
| | | showFooter: totalList.length >= res.data.count |
| | | }) |
| | | } |
| | | //设置空列表默认显示 |
| | | if (page == 1 && (list == null || list.length == 0)) { |
| | | $this.setData({ |
| | | showEmptyDefault: true |
| | | }) |
| | | } |
| | | }); |
| | | } |
| | | }, |
| | | fail: function () { |
| | | //请求失败需要将页码减1 |
| | | if ($this.data.page > 1) { |
| | | $this.setData({ |
| | | page: $this.data.page - 1 |
| | | }); |
| | | } |
| | | }, |
| | | complete: function () { |
| | | my.stopPullDownRefresh(); |
| | | setTimeout(() => { |
| | | $this.setData({ |
| | | isRequesting: false, |
| | | showLoading: false |
| | | }); |
| | | }, 1000); |
| | | } |
| | | }); |
| | | |
| | | }, |
| | | //下拉刷新 |
| | | onPullDownRefresh() { |
| | | this.requestUserMsgList(1, false); |
| | | }, |
| | | //到达底部 |
| | | async scrollMytrip() { |
| | | if (this.data.isRequesting) |
| | | return; |
| | | try { |
| | | console.log('scrollMytrip:'); |
| | | const { page, list, } = this.data; |
| | | // 判断是否还有数据需要加载 |
| | | if (list.length < this.data.total) { |
| | | //开启加载 |
| | | this.setData({ showLoading: true }); |
| | | const newPage = page + 1; |
| | | $this.requestUserMsgList(newPage); |
| | | } |
| | | } catch (e) { |
| | | this.setData({ showLoading: false }); |
| | | console.log('scrollMytrip执行异常:', e); |
| | | } |
| | | }, |
| | | }); |
| | | |
| | |
| | | <view> |
| | | <view style="height:20rpx;" /> |
| | | <list> |
| | | <list a:if="{{settings}}"> |
| | | <list-item arrow="{{false}}">参加抽奖消息 |
| | | <am-switch slot="extra" checked onChange="changeMsgSetting" data-type="1"/> |
| | | <am-switch slot="extra" checked="{{settings.joinActivityMsg}}" onChange="changeMsgSetting" data-key="joinActivityMsg"/> |
| | | </list-item> |
| | | <list-item arrow="{{false}}">开奖提醒消息 |
| | | <am-switch slot="extra" onChange="changeMsgSetting" data-type="2"/> |
| | | <am-switch slot="extra" checked="{{settings.openActivityMsg}}" onChange="changeMsgSetting" data-key="openActivityMsg"/> |
| | | </list-item> |
| | | <list-item arrow="{{false}}">成功中奖消息 |
| | | <am-switch slot="extra" onChange="changeMsgSetting" data-type="3"/> |
| | | <am-switch slot="extra" checked="{{settings.drawnMsg}}" onChange="changeMsgSetting" data-key="drawnMsg"/> |
| | | </list-item> |
| | | <list-item arrow="{{false}}">未抽中消息 |
| | | <am-switch slot="extra" checked onChange="changeMsgSetting" data-type="4"/></list-item> |
| | | <am-switch slot="extra" checked="{{settings.notDrawnMsg}}" onChange="changeMsgSetting" data-key="notDrawnMsg"/></list-item> |
| | | |
| | | <list-item arrow="{{false}}">未开抽奖消息 |
| | | <am-switch slot="extra" onChange="changeMsgSetting" data-type="5"/></list-item> |
| | | <am-switch slot="extra" checked="{{settings.notOpenActivityMsg}}" onChange="changeMsgSetting" data-key="notOpenActivityMsg"/></list-item> |
| | | <list-item arrow="{{false}}">成功助力消息 |
| | | <am-switch slot="extra" onChange="changeMsgSetting" data-type="6"/></list-item> |
| | | <am-switch slot="extra" checked="{{settings.assistSuccessMsg}}" onChange="changeMsgSetting" data-key="assistSuccessMsg"/></list-item> |
| | | </list> |
| | | </view> |
| | |
| | | var help = require('/util/help.js'); |
| | | var api = require('/util/api.js'); |
| | | var $this; |
| | | Page({ |
| | | data: {}, |
| | | data: { |
| | | }, |
| | | onLoad() { |
| | | |
| | | my.setNavigationBar({ |
| | | title: "消息设置", |
| | | backgroundColor: "#0080FF", |
| | | borderBottomColor: "#0080FF" |
| | | }); |
| | | $this = this; |
| | | help.setPageNavBar("消息设置"); |
| | | $this.requestGetSettings(); |
| | | }, |
| | | changeMsgSetting(event) { |
| | | console.log(event.target.dataset.type + ":" + event.detail.value); |
| | | } |
| | | |
| | | console.log(event); |
| | | var key = help.getEventParam(event, 'key'); |
| | | $this.data.settings[key] = event.detail.value; |
| | | var params = {}; |
| | | params[key] = event.detail.value; |
| | | $this.requestSetSettings(params); |
| | | }, |
| | | requestGetSettings() { |
| | | api.getMsgSettings({ |
| | | showErrorToast: true, |
| | | showLoading: true, |
| | | success: function (res) { |
| | | if (res.code == 0) { |
| | | $this.setData({ |
| | | settings: res.data |
| | | }) |
| | | } |
| | | } |
| | | }); |
| | | }, |
| | | requestSetSettings(setting) { |
| | | api.setMsgSettings({ |
| | | settings: setting, |
| | | showLoading: false, |
| | | success: function (res) { |
| | | $this.setData({ |
| | | settings: res.data |
| | | }) |
| | | } |
| | | }); |
| | | }, |
| | | |
| | | }); |
| | |
| | | <scroll-view scroll-y style="height:100%;"> |
| | | <view a:for="{{awardList}}" class="award"> |
| | | <flex direction="row" wrap="wrap" align="top"> |
| | | <image class="award-way" mode="scaleToFill" src="/image/portrait-test.jpg"/> |
| | | <rich-text class="award-name" nodes="{{item.awardName}}"></rich-text> |
| | | <image class="award-way" mode="scaleToFill" src="{{item.award.typeIcon}}"/> |
| | | <rich-text class="award-name" nodes="{{item.award.awardName}}"></rich-text> |
| | | </flex> |
| | | <flex direction="row" wrap="wrap" class="user-list"> |
| | | <image style="margin-right:{{(userIndex+1)%10!=0?'4rpx;':'0;'}} margin-top:{{(userIndex+1)>10?'4rpx;':'0;'}}" mode="scaleToFill" a:for-item="user" a:for-index="userIndex" src="{{user.portrait}}" a:for="{{item.userList}}"/> |
| | | </flex> |
| | | <view class="load-more"> |
| | | <view class="load-more" a:if="{{item.hasMore}}" data-index="{{index}}" onTap="loadMore"> |
| | | 加载更多 |
| | | </view> |
| | | </view> |
| | |
| | | var help = require('../../util/help.js'); |
| | | var help = require('/util/help.js'); |
| | | import parse from 'mini-html-parser2'; |
| | | import api from '/util/api.js'; |
| | | var $this; |
| | | Page({ |
| | | data: { |
| | | awardList: [] |
| | | }, |
| | | onLoad() { |
| | | onLoad(query) { |
| | | $this = this; |
| | | help.setPageNavBar("中奖公示"); |
| | | $this.data.activityId = query.activityId; |
| | | $this.requestDrwanInfo(); |
| | | |
| | | var that=this; |
| | | }, |
| | | |
| | | var awardList = [ |
| | | { |
| | | userList: [{ portrait: '/image/portrait-test.jpg' }, { portrait: '/image/portrait-test.jpg' }, { portrait: '/image/portrait-test.jpg' }, { portrait: '/image/portrait-test.jpg' },{ portrait: '/image/portrait-test.jpg' },{ portrait: '/image/portrait-test.jpg' },{ portrait: '/image/portrait-test.jpg' },{ portrait: '/image/portrait-test.jpg' },{ portrait: '/image/portrait-test.jpg' },{ portrait: '/image/portrait-test.jpg' },{ portrait: '/image/portrait-test.jpg' },{ portrait: '/image/portrait-test.jpg' },{ portrait: '/image/portrait-test.jpg' },{ portrait: '/image/portrait-test.jpg' },{ portrait: '/image/portrait-test.jpg' }, { portrait: '/image/portrait-test.jpg' }, { portrait: '/image/portrait-test.jpg' }, { portrait: '/image/portrait-test.jpg' },{ portrait: '/image/portrait-test.jpg' },{ portrait: '/image/portrait-test.jpg' },{ portrait: '/image/portrait-test.jpg' },{ portrait: '/image/portrait-test.jpg' },{ portrait: '/image/portrait-test.jpg' },{ portrait: '/image/portrait-test.jpg' },{ portrait: '/image/portrait-test.jpg' },{ portrait: '/image/portrait-test.jpg' },{ portrait: '/image/portrait-test.jpg' },{ portrait: '/image/portrait-test.jpg' }] |
| | | |
| | | }, { |
| | | |
| | | userList: [{ portrait: '/image/portrait-test.jpg' }, { portrait: '/image/portrait-test.jpg' }, { portrait: '/image/portrait-test.jpg' }, { portrait: '/image/portrait-test.jpg' },{ portrait: '/image/portrait-test.jpg' },{ portrait: '/image/portrait-test.jpg' },{ portrait: '/image/portrait-test.jpg' },{ portrait: '/image/portrait-test.jpg' },{ portrait: '/image/portrait-test.jpg' },{ portrait: '/image/portrait-test.jpg' },{ portrait: '/image/portrait-test.jpg' },{ portrait: '/image/portrait-test.jpg' },{ portrait: '/image/portrait-test.jpg' },{ portrait: '/image/portrait-test.jpg' },{ portrait: '/image/portrait-test.jpg' }, { portrait: '/image/portrait-test.jpg' }, { portrait: '/image/portrait-test.jpg' }, { portrait: '/image/portrait-test.jpg' },{ portrait: '/image/portrait-test.jpg' },{ portrait: '/image/portrait-test.jpg' },{ portrait: '/image/portrait-test.jpg' },{ portrait: '/image/portrait-test.jpg' },{ portrait: '/image/portrait-test.jpg' },{ portrait: '/image/portrait-test.jpg' },{ portrait: '/image/portrait-test.jpg' },{ portrait: '/image/portrait-test.jpg' },{ portrait: '/image/portrait-test.jpg' },{ portrait: '/image/portrait-test.jpg' }] |
| | | |
| | | }, { |
| | | userList: [{ portrait: '/image/portrait-test.jpg' }, { portrait: '/image/portrait-test.jpg' }, { portrait: '/image/portrait-test.jpg' }, { portrait: '/image/portrait-test.jpg' },{ portrait: '/image/portrait-test.jpg' },{ portrait: '/image/portrait-test.jpg' },{ portrait: '/image/portrait-test.jpg' },{ portrait: '/image/portrait-test.jpg' },{ portrait: '/image/portrait-test.jpg' },{ portrait: '/image/portrait-test.jpg' },{ portrait: '/image/portrait-test.jpg' },{ portrait: '/image/portrait-test.jpg' },{ portrait: '/image/portrait-test.jpg' },{ portrait: '/image/portrait-test.jpg' },{ portrait: '/image/portrait-test.jpg' }, { portrait: '/image/portrait-test.jpg' }, { portrait: '/image/portrait-test.jpg' }, { portrait: '/image/portrait-test.jpg' },{ portrait: '/image/portrait-test.jpg' },{ portrait: '/image/portrait-test.jpg' },{ portrait: '/image/portrait-test.jpg' },{ portrait: '/image/portrait-test.jpg' },{ portrait: '/image/portrait-test.jpg' },{ portrait: '/image/portrait-test.jpg' },{ portrait: '/image/portrait-test.jpg' },{ portrait: '/image/portrait-test.jpg' },{ portrait: '/image/portrait-test.jpg' },{ portrait: '/image/portrait-test.jpg' }] |
| | | |
| | | } |
| | | ]; |
| | | |
| | | |
| | | //封装奖项的富文本 |
| | | this.loadRichTextNode(help.getAwardHtml({}), function (nodes) { |
| | | for (var i = 0; i <awardList.length; i++) { |
| | | awardList[i].awardName = nodes; |
| | | } |
| | | that.setData({ |
| | | awardList: awardList |
| | | }); |
| | | }); |
| | | loadMore(event) { |
| | | var index = help.getEventParam(event, "index"); |
| | | $this.requestDrawnJoinerList($this.data.awardList[index].page, index); |
| | | }, |
| | | |
| | | loadRichTextNode(html, callback) { |
| | |
| | | }); |
| | | }, |
| | | |
| | | requestDrwanInfo() { |
| | | api.getDrawnInfo({ |
| | | activityId: $this.data.activityId, |
| | | count: 20, |
| | | showErrorToast: true, |
| | | showLoading:true, |
| | | success: function (res) { |
| | | if (res.code == 0) { |
| | | var data = res.data.data; |
| | | for (var i = 0; i < data.length; i++) { |
| | | //封装奖项的富文本 |
| | | $this.loadRichTextNode(help.getAwardHtml({ content: data[i].award.title, link: data[i].award.link, moreType: 'text' }), function (nodes) { |
| | | data[i].award.awardName = nodes; |
| | | }); |
| | | |
| | | //计算是否还有更多 |
| | | if (data[i].userList.length < data[i].userCount) { |
| | | data[i].hasMore = true; |
| | | } else { |
| | | data[i].hasMore = false; |
| | | } |
| | | data[i].page = 1; |
| | | } |
| | | |
| | | $this.setData({ |
| | | awardList: data |
| | | }); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | |
| | | }, |
| | | requestDrawnJoinerList(page, index) { |
| | | |
| | | var data = $this.data.awardList; |
| | | data[index].page = page; |
| | | |
| | | api.getDrawnJoinerList({ |
| | | showErrorToast: true, |
| | | showLoading: true, |
| | | page: page, |
| | | activityId: $this.data.activityId, |
| | | awardId: data[index].award.id, |
| | | success: function (res) { |
| | | if (res.code == 0) { |
| | | data[index].userList = data[index].userList.concat(res.data.data); |
| | | data[index].userCount = res.data.count; |
| | | $this.setData({ |
| | | awardList: data |
| | | }); |
| | | |
| | | } |
| | | }, |
| | | fail: function (e) { |
| | | if (page > 1) { |
| | | data = $this.data.awardList; |
| | | data[index].page = page - 1; |
| | | $this.setData({ |
| | | awardList: data |
| | | }); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | |
| | | } |
| | | |
| | | }); |
| | |
| | | <scroll-view a:if="{{!showEmptyDefault&&list.length>0}}" style="height: 100vh;" |
| | | scroll-y onScrollToLower="scrollMytrip" enable-back-to-top="true"> |
| | | <notice class="notice" marqueeProps="{{loop:true}}" enableMarquee="{{true}}" show="{{showNotice}}" mode="{{noticeMode}}" onClick="onNoticeClick"> |
| | | 无限循环滚动的通告栏展示情况。文字不够继续添加文字凑数。 |
| | | {{notice.content}} |
| | | </notice> |
| | | <import src="../template/template.axml"/> |
| | | <template is="commonActivityListItem" a:for="{{list}}" data="{{item}}"/> |
| | |
| | | var help = require('../../util/help.js'); |
| | | var api = require('../../util/api.js'); |
| | | var help = require('/util/help.js'); |
| | | var api = require('/util/api.js'); |
| | | var $this; |
| | | Page({ |
| | | data: { |
| | |
| | | //过期未领弹框 |
| | | showOutDateModal: false, |
| | | |
| | | showNotice: true, |
| | | showNotice: false, |
| | | noticeMode: 'closable',//closable |
| | | }, |
| | | |
| | | onLoad() { |
| | | help.setPageNavBar("天天领现金"); |
| | | $this = this; |
| | | $this.requestNotice(); |
| | | $this.requestActivity(1, true); |
| | | }, |
| | | //请求活动 |
| | |
| | | $this.setData({ |
| | | page: page, |
| | | isRequesting: true, |
| | | showEmptyDefault:false |
| | | showEmptyDefault: false |
| | | }); |
| | | api.getRecommendActivity({ |
| | | data: { |
| | | page: page |
| | | }, |
| | | showErrorToast: true, |
| | | showLoading: first, |
| | | success: function (res) { |
| | | console.log(res) |
| | |
| | | showEmptyDefault: true |
| | | }) |
| | | } |
| | | } else { |
| | | my.showToast({ |
| | | content: res.msg |
| | | }); |
| | | } |
| | | }, |
| | | fail: function () { |
| | |
| | | }); |
| | | }, 1000); |
| | | |
| | | } |
| | | }); |
| | | |
| | | }, |
| | | requestNotice() { |
| | | api.getNotice({ |
| | | position: 'home', |
| | | success(res) { |
| | | if (res.code == 0) { |
| | | $this.setData({ |
| | | notice: res.data, |
| | | showNotice: true, |
| | | noticeMode: res.data.link?'link':'closable' |
| | | }) |
| | | } |
| | | } |
| | | }); |
| | | |
| | |
| | | my.showToast({ |
| | | content: "进入详情" |
| | | }); |
| | | if ($this.data.notice.link) { |
| | | my.navigateTo({ |
| | | url: '/pages/web/web?url=' + $this.data.notice.link |
| | | }) |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | |
| | | var help = require('../../util/help.js'); |
| | | var api = require('../../util/api.js'); |
| | | var help = require('/util/help.js'); |
| | | var api = require('/util/api.js'); |
| | | var $this; |
| | | Page({ |
| | | data: { |
| | |
| | | }); |
| | | api.getScanActivityRecord({ |
| | | page: page, |
| | | showErrorToast: true, |
| | | showLoading: first, |
| | | success: function (res) { |
| | | console.log(res) |
| | |
| | | showEmptyDefault: true |
| | | }) |
| | | } |
| | | } else { |
| | | my.showToast({ |
| | | content: res.msg |
| | | }); |
| | | } |
| | | }, |
| | | fail: function () { |
| | |
| | | var help = require('../../util/help.js'); |
| | | var api = require('../../util/api.js'); |
| | | var help = require('/util/help.js'); |
| | | var api = require('/util/api.js'); |
| | | var $this; |
| | | var $sponsorId; |
| | | var $activityId; |
| | |
| | | $this.setData({ |
| | | page: page, |
| | | isRequesting: true, |
| | | showEmptyDefault:false |
| | | showEmptyDefault: false |
| | | }); |
| | | api.getSponsorActivity({ |
| | | page: page, |
| | | sponsorId: $sponsorId, |
| | | activityId: $activityId, |
| | | showErrorToast: true, |
| | | showLoading: first, |
| | | success: function (res) { |
| | | console.log(res) |
| | |
| | | showEmptyDefault: true |
| | | }) |
| | | } |
| | | } else { |
| | | my.showToast({ |
| | | content: res.msg |
| | | }); |
| | | } |
| | | }, |
| | | fail: function () { |
| | |
| | | var help = require("../../util/help.js") |
| | | const source_1 = ["淘客", "测试1", "测试1", "测试1"]; |
| | | const source_2 = ["测试1", "测试2", "测试3", "测试4"]; |
| | | var help = require('/util/help.js'); |
| | | const api = require("/util/api.js"); |
| | | const source_1 = ["淘宝客", |
| | | "招商团长", |
| | | "C店商家", |
| | | "B店商家", |
| | | "直播主播", |
| | | "商务", |
| | | "其他"]; |
| | | const source_2 = ["流量互换", |
| | | "品质商品", |
| | | "资源信息", |
| | | "商务合作", |
| | | "其他"]; |
| | | Page({ |
| | | data: { |
| | | data1: '', |
| | |
| | | }); |
| | | return; |
| | | } |
| | | |
| | | api.sponsorSignUp({ |
| | | showErrorToast: true, |
| | | showLoading: true, |
| | | identity: this.data.data1, |
| | | provider: this.data.data2, |
| | | phone: phone, |
| | | success: function (res) { |
| | | if (res.code == 0) { |
| | | my.showToast({ |
| | | content: res.msg |
| | | }); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | }); |
| | |
| | | var help = require('../../util/help.js'); |
| | | var help = require('/util/help.js'); |
| | | var http = require('../../util/http.js'); |
| | | |
| | | Page({ |
| | |
| | | console.log(obj.data); |
| | | |
| | | http.postApi(url, obj.data, function (res) { |
| | | if (obj.success) |
| | | if (obj.success) { |
| | | obj.success(res.data); |
| | | if (obj.showErrorToast) { |
| | | try { |
| | | if (res.data.code != 0) { |
| | | my.showToast({ |
| | | content: res.data.msg |
| | | }); |
| | | } |
| | | } catch (e) { |
| | | } |
| | | } |
| | | } |
| | | }, function (res) { |
| | | my.showToast({ |
| | | content: '网络请求出错' |
| | |
| | | obj.complete(); |
| | | }, obj.showLoading); |
| | | }, |
| | | getConfig(obj) { |
| | | obj.data = {}; |
| | | this.commonRequest("/api/client/config/getConfig", obj); |
| | | }, |
| | | |
| | | /** |
| | | * |
| | | * @param {*} obj |
| | | */ |
| | | getNotice(obj) { |
| | | obj.data = { position: obj.position }; |
| | | this.commonRequest("/api/client/anouncement/getNotice", obj); |
| | | }, |
| | | |
| | | |
| | | /** |
| | | * 获取推荐活动 |
| | |
| | | getJoinerList(obj) { |
| | | obj.data = { page: obj.page, activityId: obj.activityId }; |
| | | this.commonRequest("/api/client/activity/join/getJoinerList", obj); |
| | | }, |
| | | |
| | | /** |
| | | * 活动助力列表 |
| | | * @param {*} obj |
| | | */ |
| | | getActivityAssistCouponList(obj) { |
| | | obj.data = { page: obj.page, activityId: obj.activityId }; |
| | | this.commonRequest("/api/client/activity/assist/getActivityAssistCouponList", obj); |
| | | }, |
| | | |
| | | /** |
| | | * 获取中奖信息 |
| | | * @param {*} obj |
| | | */ |
| | | getDrawnInfo(obj) { |
| | | obj.data = { count: obj.count, activityId: obj.activityId }; |
| | | this.commonRequest("/api/client/activity/awards/getDrawnInfo", obj); |
| | | }, |
| | | /** |
| | | * 获取中奖参与者列表 |
| | | * @param {*} obj |
| | | */ |
| | | getDrawnJoinerList(obj) { |
| | | obj.data = { awardId: obj.awardId, activityId: obj.activityId, page: obj.page }; |
| | | this.commonRequest("/api/client/activity/awards/getDrawnJoinerList", obj); |
| | | |
| | | }, |
| | | |
| | | /** |
| | | * 获取助力好友 |
| | | * @param {*} obj |
| | | */ |
| | | getAssistFriendsList(obj) { |
| | | obj.data = { page: obj.page }; |
| | | this.commonRequest("/api/client/activity/assist/getAssistFriendsList", obj); |
| | | }, |
| | | |
| | | getUserMsgList(obj) { |
| | | obj.data = { page: obj.page }; |
| | | this.commonRequest("/api/client/user/getUserMsgList", obj); |
| | | }, |
| | | |
| | | getUserConfig(obj) { |
| | | obj.data = {}; |
| | | this.commonRequest("/api/client/user/getUserConfig", obj); |
| | | }, |
| | | |
| | | setMsgRead(obj) { |
| | | obj.data = {}; |
| | | this.commonRequest("/api/client/user/setMsgRead", obj); |
| | | }, |
| | | |
| | | |
| | | getMsgSettings(obj) { |
| | | obj.data = {}; |
| | | this.commonRequest("/api/client/user/getMsgSettings", obj); |
| | | }, |
| | | setMsgSettings(obj) { |
| | | obj.data = obj.settings; |
| | | this.commonRequest("/api/client/user/setMsgSettings", obj); |
| | | }, |
| | | advice(obj) { |
| | | obj.data = { content: obj.content }; |
| | | this.commonRequest("/api/client/config/advice", obj); |
| | | }, |
| | | sponsorSignUp(obj) { |
| | | obj.data = { identity: obj.identity, provider: obj.provider, phone: obj.phone }; |
| | | this.commonRequest("/api/client/config/sponsorSignUp", obj); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | }; |
| | | |
| | | module.exports = api; |
| | |
| | | var help = { |
| | | import parse from 'mini-html-parser2'; |
| | | var help; |
| | | help = { |
| | | getEventParam(event, name) { |
| | | return event.target.dataset[name]; |
| | | }, |
| | | setPageNavBar(title) { |
| | | my.setNavigationBar({ |
| | | title: title, |
| | | var data = { |
| | | backgroundColor: getApp().themeColor, |
| | | borderBottomColor: getApp().themeColor |
| | | }); |
| | | } |
| | | if (title != null) { |
| | | data.title = title; |
| | | } |
| | | |
| | | my.setNavigationBar(data); |
| | | }, |
| | | isNullOrEmpty(str) { |
| | | if (str == undefined || str == null || str.length == 0) |
| | |
| | | html += "</div>"; |
| | | console.log(html); |
| | | return html; |
| | | }, |
| | | |
| | | |
| | | /** |
| | | * 通过html文件获取富文本 |
| | | * @param {*} html |
| | | * @param {*} callback |
| | | */ |
| | | loadRichTextNode(html, callback) { |
| | | parse(html, (err, nodes) => { |
| | | console.log(nodes); |
| | | if (!err) { |
| | | callback(nodes); |
| | | } |
| | | }); |
| | | }, |
| | | |
| | | //获取助力进度html |
| | |
| | | hh: h < 10 ? '0' + h : h, |
| | | } |
| | | }, |
| | | getUid() { |
| | | let data = my.getStorageSync({ |
| | | key: 'uid' |
| | | cacheConfig(params) { |
| | | my.setStorage({ |
| | | key: 'config', |
| | | data: params |
| | | }); |
| | | return data.data; |
| | | }, |
| | | |
| | | getCachedConfig(callback) { |
| | | let data = my.getStorage({ |
| | | key: 'config', |
| | | success: function (res) { |
| | | callback(res.data); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | |
| | |
| | | params = {}; |
| | | params.timestamp = new Date().getTime(); |
| | | params.appKey = getApp().appKey; |
| | | params.version=getApp().version; |
| | | |
| | | var array = new Array(); |
| | | for (var key in params) { |
New file |
| | |
| | | const api = require("./api.js"); |
| | | const help = require("./help.js"); |
| | | var user = { |
| | | login(obj) { |
| | | my.getOpenUserInfo({ |
| | | fail: (res) => { |
| | | }, |
| | | success: (res) => { |
| | | let userInfo = JSON.parse(res.response).response // 以下方的报文格式解析两层 response |
| | | if (userInfo.code == '10000') {//成功 |
| | | console.log(JSON.stringify(userInfo)) |
| | | help.rsa(JSON.stringify(userInfo), function (res) { |
| | | api.uploadUserInfo({ |
| | | userInfo: res, |
| | | showErrorToast: true, |
| | | showLoading: true, |
| | | success: function (res) { |
| | | if (res.code == 0) { |
| | | //保存用户信息 |
| | | my.setStorage({ |
| | | key: 'user', |
| | | data: res.data |
| | | }); |
| | | getApp().logined = true; |
| | | |
| | | if (obj.success) { |
| | | obj.success(res.data) |
| | | } |
| | | } |
| | | } |
| | | }) |
| | | }); |
| | | } else { |
| | | my.showToast({ |
| | | content: '授权失败' |
| | | }); |
| | | } |
| | | } |
| | | }); |
| | | }, |
| | | logout(obj) { |
| | | my.removeStorage({ |
| | | key: 'user', |
| | | success: () => { |
| | | getApp().logined = false; |
| | | if (obj.success) |
| | | obj.success(); |
| | | }, |
| | | fail: () => { |
| | | if (obj.fail) |
| | | obj.fail(); |
| | | }, |
| | | complete: () => { |
| | | |
| | | } |
| | | }); |
| | | }, |
| | | getUserInfo(obj) { |
| | | my.getStorage({ |
| | | key: 'user', |
| | | success: (result) => { |
| | | if (result.data) { |
| | | getApp().logined = true; |
| | | obj.success(result.data); |
| | | } else { |
| | | console.log("用户未登录") |
| | | } |
| | | }, |
| | | fail: () => { |
| | | |
| | | }, |
| | | complete: () => { |
| | | |
| | | } |
| | | }); |
| | | |
| | | }, |
| | | init() { |
| | | my.getStorage({ |
| | | key: 'user', |
| | | success: (result) => { |
| | | if (result.data) { |
| | | getApp().logined = true; |
| | | console.log("用户已登录") |
| | | } else { |
| | | console.log("用户未登录") |
| | | } |
| | | }, |
| | | fail: () => { |
| | | |
| | | }, |
| | | complete: () => { |
| | | |
| | | } |
| | | }); |
| | | |
| | | } |
| | | |
| | | }; |
| | | |
| | | module.exports = user; |