Authored by 邱骏

form

... ... @@ -274,5 +274,8 @@ App({
},
getSystemInfo() {
return this.globalData.systemInfo;
},
getMiniappType() {
return config.mini_app_type;
}
});
... ...
... ... @@ -24,7 +24,8 @@ const config = {
unionType: '', // 渠道号
MINI_APP_DOMAIN: 'miniapp.yohobuy.com',
appid: 'wx39f299b6485cf97a', // 业务中使用、与package.config.json内appid保持一致wx39f299b6485cf97a
business_line: 'miniappOffshop' // 业务线
business_line: 'miniappOffshop', // 业务线
mini_app_type: 4
};
export default config;
... ...
... ... @@ -4,8 +4,9 @@ import event from '../../common/event';
import LimitModel from '../../models/limit/index';
import helper from '../../utils/helper';
import wx from '../../utils/wx';
import { Actionsheet } from '../../vendors/zanui/index';
import { stringify } from '../../vendors/query-stringify';
import {Actionsheet} from '../../vendors/zanui/index';
import {stringify} from '../../vendors/query-stringify';
import commonModel from '../../models/common';
let app = getApp();
let router = global.router;
... ... @@ -17,19 +18,28 @@ let router = global.router;
*/
/**
* 接口:获取用户排队信息
* https://api.yoho.cn/?activityId=179&app_version=6.4.0&client_secret=ee1114702f3db67327afe9eeeac92b5a&client_type=iphone&fromPage=iFP_Queue&method=app.drawline.getUserActivityInfo&os_version=11.2.5&physical_channel=1&screen_size=375x667&session_key=3c9a644c3d95d9a7453c61f3009b2884&udid=1a61c0b4db7b6e27999b1237977b5347eb503956&uid=349709&v=7
* method=app.drawline.getUserActivityInfo
* activityId=179
*
* 接口:获取排队用户信息
* https://api.yoho.cn/?activityId=179&app_version=6.4.0&client_secret=e8f42148d30976fb44dfff1d89ea7a60&client_type=iphone&fromPage=iFP_Queue&limit=50&method=app.drawline.getQueueList&os_version=11.2.5&physical_channel=1&screen_size=375x667&session_key=3c9a644c3d95d9a7453c61f3009b2884&sort=0&udid=1a61c0b4db7b6e27999b1237977b5347eb503956&uid=349709&v=7
*
* 接口:排队活动
* https://api.yoho.cn/?activityId=179&app_version=6.4.0&client_secret=52db394bdb79e2dcf0e2a2782496ee78&client_type=iphone&fromPage=iFP_Queue&method=app.drawline.getActivityInfo&os_version=11.2.5&physical_channel=1&screen_size=375x667&session_key=3c9a644c3d95d9a7453c61f3009b2884&udid=1a61c0b4db7b6e27999b1237977b5347eb503956&uid=349709&v=7
* 接口:获取排队用户信息(列表)
* method=app.drawline.getQueueList
* activityId=179
* limit=50
* sort=0
*
*
* 接口:排队活动信息
* method=app.drawline.getActivityInfo
* activityId=179
*
*
* 接口:中奖列表
* https://api.yoho.cn/?activityId=179&app_version=6.4.0&client_secret=936b01c80de696e81c59fee6ea64fd50&client_type=iphone&fromPage=iFP_QueueResult&limit=20&method=app.drawline.getLuckyUserList&os_version=11.2.6&page=1&physical_channel=1&screen_size=375x667&session_key=3c9a644c3d95d9a7453c61f3009b2884&udid=1a61c0b4db7b6e27999b1237977b5347eb503956&uid=349709&v=7
* method=app.drawline.getLuckyUserList
* activityId=179
* limit=20
* page=1
*
* 接口:添加用户分享记录
* https://api.yoho.cn/?activityId=294&app_version=6.4.0&client_secret=e7ecfcd3410f5c8b0054c07b8366a700&client_type=iphone&fromPage=iFP_LimitPurchaseDetail&method=app.limitProduct.addUserShare&os_version=11.2.6&physical_channel=1&screen_size=375x667&session_key=d4c06294461b138058ce3aa2978cd602&udid=1a61c0b4db7b6e27999b1237977b5347eb503956&uid=349709&v=7 HTTP/1.1
*/
Page(Object.assign({
... ... @@ -125,7 +135,7 @@ Page(Object.assign({
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
onLoad: function (options) {
console.log(options);
let actId = options.actId;
let uid = app.getUid();
... ... @@ -154,14 +164,14 @@ Page(Object.assign({
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function() {
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function(options) {
onShow: function (options) {
setTimeout(this.hidePopup, 4000);
if (app.getUid()) {
this.setData({
... ... @@ -173,19 +183,19 @@ Page(Object.assign({
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function() {
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function() {
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function() {
onPullDownRefresh: function () {
let actId = this.data.activityInfo.activityId;
if (actId) {
... ... @@ -202,7 +212,7 @@ Page(Object.assign({
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function() {
onReachBottom: function () {
console.log('到底部啦');
let actId = this.data.activityInfo.activityId;
let sort = this.data.queueList[this.data.queueList.length - 1].sort;
... ... @@ -219,7 +229,7 @@ Page(Object.assign({
/**
* 用户点击右上角分享
*/
onShareAppMessage: function(res) {
onShareAppMessage: function (res) {
let params = {
FROM: res.from,
SHARE_RESUIL: 0,
... ... @@ -236,15 +246,15 @@ Page(Object.assign({
desc: params.DESC, // 分享描述
path: params.PATH, // 分享路径
imageUrl: params.IMG,
success: function() {
success: function () {
params.SHARE_RESUIL = 1;
},
fail: function() {
fail: function () {
params.SHARE_RESUIL = 2;
}
};
},
share: function() {
share: function () {
this.setData({
'actionSheet.show': true
});
... ... @@ -272,14 +282,14 @@ Page(Object.assign({
/**
* 邀请好友助力排队按钮
*/
inviteFriends: function(e) {
inviteFriends: function (e) {
this.share();
},
/**
* scroll-view滚动事件
*/
scroll: function(e) {
scroll: function (e) {
console.log(e);
let scrollTop = e.detail.scrollTop;
... ... @@ -291,14 +301,14 @@ Page(Object.assign({
/**
* 跳转到我的排队列表
*/
navigateToMyList: function(e) {
navigateToMyList: function (e) {
router.go('myList', Object.assign({actId: this.data.activityInfo.activityId}, this.data.shareInfo));
},
/**
* 点击用户头像,跳转到用户对应位置<已取消该功能>
*/
userTap: function(e) {
userTap: function (e) {
console.log(this.data.userInfo);
let uid = this.data.userInfo.uid;
let sort = this.data.userInfo.sort || 0;
... ... @@ -330,7 +340,7 @@ Page(Object.assign({
/**
* 关闭提示框
*/
closeMsg: function(e) {
closeMsg: function (e) {
this.setData({
showMsg: 0
});
... ... @@ -339,7 +349,7 @@ Page(Object.assign({
/**
* 隐藏气泡
*/
hidePopup: function(e) {
hidePopup: function (e) {
this.setData({
hidePopup: 1
});
... ... @@ -348,7 +358,7 @@ Page(Object.assign({
/**
* 点击参加活动按钮
*/
joinInQueue: function(e) {
joinInQueue: function (e) {
let uid = app.getUid();
let activityId = this.data.activityInfo.activityId;
let isEnd = this.data.activityInfo.isEnd === 0 ? 0 : 1;
... ... @@ -363,14 +373,14 @@ Page(Object.assign({
let pages = getCurrentPages();
let referer = pages[pages.length - 1].route + '?' + stringify(this.data.shareInfo);
router.go('userCenter', { referer });
router.go('userCenter', {referer});
}
},
/**
* 获取活动信息
*/
getActivityInfo: function(actId) {
getActivityInfo: function (actId) {
return LimitModel.getActivityInfo(actId).then(res => { // 获取活动信息
console.log(res);
if (res.code === 200) {
... ... @@ -405,7 +415,7 @@ Page(Object.assign({
/**
* 加入排队
*/
addQueue: function(actId, uid) {
addQueue: function (actId, uid) {
if (!this.data.api_status) {
this.setData({
api_status: 1
... ... @@ -436,7 +446,7 @@ Page(Object.assign({
/**
* 获取用户参与排队的信息
*/
getUserActivityInfo: function(actId) {
getUserActivityInfo: function (actId) {
LimitModel.getUserActivityInfo(actId).then(res => {
console.log('getUserActivityInfo:', res);
this.setData({
... ... @@ -460,7 +470,7 @@ Page(Object.assign({
/**
* 获取排队列表
*/
getQueueList: function(actId, start = 0, limit = 50, isAdd = false) {
getQueueList: function (actId, start = 0, limit = 50, isAdd = false) {
let that = this;
actId = actId || this.data.activityInfo.activityId;
... ... @@ -502,7 +512,7 @@ Page(Object.assign({
}
});
},
scrollPage: function(id) { // 滚动页面到对应位置
scrollPage: function (id) { // 滚动页面到对应位置
if (id) {
let item_query = wx.createSelectorQuery();
... ... @@ -528,14 +538,14 @@ Page(Object.assign({
/**
* 跳转到活动说明的H5页面
*/
navigateToDescPage: function() {
navigateToDescPage: function () {
router.goUrl(this.data.h5PageUrl[0].url + '&title=' + this.data.h5PageUrl[0].title);
},
/**
*跳转到中奖名单页面
*/
navigateToPrizeUserList: function() {
navigateToPrizeUserList: function () {
if (this.data.activityInfo.isDrawEnd) {
router.go('prizeUserList', {actId: this.data.activityInfo.activityId});
}
... ... @@ -544,20 +554,32 @@ Page(Object.assign({
/**
* 跳转到个人中心限购码页面
*/
navigateToUserCodePage: function() {
navigateToUserCodePage: function () {
if (this.data.userInfo.isLucky) {
router.go('userCenter');
}
},
/**
* 提交formId消息模板
*/
submitFormId: function (e) {
console.log(e);
commonModel.addWechatFormId({
formId: e.detail.formId,
uid: app.getUid() || 0,
openId: app.getUnionID() || app.getOpenID() || '',
miniappType: app.getMiniappType()
});
},
/**
* 处理接口返回的图片url
*/
formatImgUrl: function(url, mode, width, height) {
formatImgUrl: function (url, mode, width, height) {
return url.replace(/{mode}/g, mode).replace(/{width}/g, width).replace(/{height}/g, height);
},
formatTimeText: function(time) {
formatTimeText: function (time) {
let new_time;
if (time < 60) {
... ...
... ... @@ -141,8 +141,10 @@
</view>
</block>
</view>
<view class='invite-button' hidden='{{hideInviteButton}}' bindtap='inviteFriends'>
<form bindsubmit='submitFormId' report-submit='true'>
<button class='invite-button' hidden='{{hideInviteButton}}' form-type='submit' bindtap='inviteFriends'>
邀请好友助力排队
</view>
</button>
</form>
</view>
<template is="zan-actionsheet" data="{{...actionSheet}}" />
\ No newline at end of file
... ...
... ... @@ -200,6 +200,18 @@ Page(Object.assign({
},
/**
* 提交formId消息模板
*/
submitFormId: function (e) {
commonModel.addWechatFormId({
formId: e.detail.formId,
uid: app.getUid() || 0,
openId: app.getUnionID() || app.getOpenID() || '',
miniappType: app.getMiniappType()
});
},
/**
* 获取排队列表
*/
getQueueList: function(actId, limit = 10) {
... ...
... ... @@ -30,8 +30,10 @@
</view>
</view>
</block>
<view class='invite-button' hidden='{{hideInviteButton}}' bindtap='inviteFriends'>
<form bindsubmit='submitFormId' report-submit='true'>
<button class='invite-button' hidden='{{hideInviteButton}}' form-type='submit' bindtap='inviteFriends'>
邀请好友助力排队
</view>
</button>
</form>
</view>
<template is="zan-actionsheet" data="{{...actionSheet}}" />
\ No newline at end of file
... ...
... ... @@ -33,7 +33,7 @@
"list": []
},
"miniprogram": {
"current": 8,
"current": 4,
"list": [
{
"id": 0,
... ...