Commit 6c09f169 by jscat

nyx weapp 产品功能

1. 添加获取积分 points 的功能
2. 添加获取某一个积分 qrcode 的功能
3. 添加获取某一组积分助力 bonus 的功能
parent f4cd7cdb
//config.js API全局域名配置 //config.js API全局域名配置
//config.js API全局域名配置 //config.js API全局域名配置
var prod = 0; //阿里云服务器生产版本 var prod = 0; //阿里云服务器生产版本
var local = 0; //本地java测试,需要启动java 后台 var local = 1; //本地java测试,需要启动java 后台
var test = 1; //阿里云服务器测试版本 var test = 0; //阿里云服务器测试版本
var debug = 0; //是否打印调试信息 var debug = 0; //是否打印调试信息
var host_key = "https://fun.hisuhong.com"; var host_key = "https://fun.hisuhong.com";
...@@ -40,17 +40,12 @@ var config={ ...@@ -40,17 +40,12 @@ var config={
msg_like_url: host_key + "/api/nyx/msg/like", msg_like_url: host_key + "/api/nyx/msg/like",
user_login_url: login_url+"/api/nyx/user/wxLogin", user_login_url: login_url+"/api/nyx/user/wxLogin",
test_url : host_key + "/api/nyx/match/test", test_url : host_key + "/api/nyx/match/test",
match_rank_query_url: host_key + "/api/nyx/match/rank/query",
quiz_total_query_url: host_key + "/api/nyx/quiz/total/query",
match_rank_update_url: host_key + "/api/nyx/match/rank/update",
quiz_study_query_url: host_key + "/api/nyx/quiz/query/study",
match_add_item_url: host_key + "/api/nyx/match/add/item", match_add_item_url: host_key + "/api/nyx/match/add/item",
user_reg_url: host_key + "/api/nyx/user/reg", user_reg_url: host_key + "/api/nyx/user/reg",
userinfo_query_url: host_key + "/api/nyx/userinfo/query", userinfo_query_url: host_key + "/api/nyx/userinfo/query",
notes_query_url: host_key + "/api/nyx/post/query", notes_query_url: host_key + "/api/nyx/post/query",
city_list_url: host_key + "/api/nyx/citylist/query", points_query_url: host_key + "/api/nyx/match/point/query",
city_query_url: host_key + "/api/nyx/city/query", bonus_query_url: host_key + "/api/nyx/match/bonus/query/id",
member_query_url: host_key + "/api/nyx/member/pos/query",
socket_url: socket_url, socket_url: socket_url,
oss_token_url: host_key + "/api/nyx/oss/getToken", oss_token_url: host_key + "/api/nyx/oss/getToken",
oss_callback_url: login_url + "/api/nyx/oss/callback", oss_callback_url: login_url + "/api/nyx/oss/callback",
......
// pages/my/rank/rank.js // pages/my/rank/rank.js
...@@ -12,7 +12,14 @@ Page({ ...@@ -12,7 +12,14 @@ Page({
nyxCode: "", nyxCode: "",
authStatus: "", authStatus: "",
userInfo: {}, userInfo: {},
matchSeason: "",
//积分信息
points : [],
//助力信息
bonus_info : [],
//选中barcode的qrcode和url
qrcode : "",
qrcode_url : "",
// { // {
// rankId : "rid_001", // rankId : "rid_001",
...@@ -23,7 +30,6 @@ Page({ ...@@ -23,7 +30,6 @@ Page({
// score : "200", // score : "200",
// ratio : "96%", // ratio : "96%",
// }, // },
rankList : [],
isHideLoadMore: false, isHideLoadMore: false,
/* 模态框 */ /* 模态框 */
...@@ -54,6 +60,14 @@ Page({ ...@@ -54,6 +60,14 @@ Page({
}) })
} }
//初始载入四个积分
if(_this.__data__.points.length == 0)
{
//getPoints(scrollType, pageNum, pageCount, matchStatus)
//onLoad的时候展示可使用的积分
var matchStatus = "01"
_this.getPoints(0, 1, 4, matchStatus);
}
}, },
...@@ -108,17 +122,29 @@ Page({ ...@@ -108,17 +122,29 @@ Page({
/* /*
*/ */
/* 点击好友助力 */ /* 点击好友助力 */
onClickPoints: function(){ onClickPoints: function(e){
    this.setData({ var _this = this;
var indexId = e.currentTarget.dataset.id
var match_id = _this.__data__.points[indexId].match_id
_this.getBonus(match_id)
    _this.setData({
      showModalPoints: true       showModalPoints: true
    })     })
}, },
/* 点击barcode */ /* 点击barcode */
onClickBarcode: function(){ onClickBarcode: function(e){
var _this = this;
//指明具体是list的哪一个item
var indexId = e.currentTarget.dataset.id
var qrcode_url = _this.__data__.points[indexId].qrcode_url
var qrcode = _this.__data__.points[indexId].match_id
    this.setData({     this.setData({
      showModalBarcode: true       showModalBarcode : true,
    }) qrcode : qrcode,
qrcode_url : qrcode_url
    })
}, },
  // 弹出层里面的弹窗   // 弹出层里面的弹窗
...@@ -133,15 +159,107 @@ Page({ ...@@ -133,15 +159,107 @@ Page({
* tab切换 * tab切换
*/ */
tab: function(e) { tab: function(e) {
var _this = this;
//js的e.currentTarget.id 对应wxml的 id="tab0" //js的e.currentTarget.id 对应wxml的 id="tab0"
//js的e.currentTarget.dataSet.id 对应wxml的 data-id="tab0" //js的e.currentTarget.dataSet.id 对应wxml的 data-id="tab0"
var id = e.currentTarget.id; var id = e.currentTarget.id;
var dataId = e.currentTarget.dataset.id var dataId = e.currentTarget.dataset.id
this.setData({ _this.setData({
validStatus: dataId=="tab0"?true:false, validStatus: dataId=="tab0"?true:false,
}) })
var matchStatus = dataId=="tab0" ? "01" : "00"
_this.getPoints(0, 1, 4, matchStatus)
},
/**
* 用户自定义函数
*
*/
// 获取points数据
// scrollType: 是否是翻页, 0-不翻页 | 1-翻页
getPoints: function (scrollType, pageNum, pageCount, memberStatus) {
var _this = this;
var query_url = '&matchStatus='+memberStatus
var strUrl = config.points_query_url + "?pageCount=" + pageCount
+ "&pageNum=" + pageNum + query_url
config.debug == 1 ? console.log("===strUrl is: \"" + strUrl + "\"") : ""
wx.request({
url: strUrl,
method: 'GET',
header: {
'Cookie': wx.getStorageSync('cookieKey'),
},
success: function (res) {
if (res.data.resultCode == 200) {
//表示HTTP请求成功
console.log(res.data);
var list = []
var bisHideLoadMoreType = false;
if (res.data.data.length < pageCount) {
bisHideLoadMoreType = true;
}
for (var i = 0; i < res.data.data.length; i++) {
var result = {}
result["total_point"] = res.data.data[i].totalPoint
result["member_name"] = res.data.data[i].memberName
result["bonus_count"] = res.data.data[i].bonusCount
result["bonus_point"] = res.data.data[i].bonusPoint
result["match_id"] = res.data.data[i].matchId
result["qrcode_url"] = res.data.data[i].qrcodeUrl
list.push(result)
}
//进行翻页设置(加载更多)
if (scrollType == 1) {
var pointList = _this.__data__.points;
list = pointsList.concat(list)
}
_this.setData({
points: list,
pageIndex: pageNum + 1,
isHideLoadMore: bisHideLoadMoreType,
})
}
}
})
}, },
// 获取bonus points数据
getBonus: function (matchId) {
var _this = this;
var query_url = '?matchId='+matchId
var strUrl = config.bonus_query_url + query_url
config.debug == 1 ? console.log("===strUrl is: \"" + strUrl + "\"") : ""
wx.request({
url: strUrl,
method: 'GET',
header: {
'Cookie': wx.getStorageSync('cookieKey'),
},
success: function (res) {
if (res.data.resultCode == 200) {
//表示HTTP请求成功
console.log(res.data);
var list = []
for (var i = 0; i < res.data.data.length; i++) {
var result = {}
result["match_id"] = res.data.data[i].matchId
result["user_name"] = res.data.data[i].userName
result["bonus_point"] = res.data.data[i].bonusPoint
list.push(result)
}
_this.setData({
bonus_info: list,
})
}
}
})
},
}) })
\ No newline at end of file
<view class="page"> <view class="page">
...@@ -12,14 +12,16 @@ ...@@ -12,14 +12,16 @@
</view> </view>
<!-- Content: refer to 有品·优惠券 + 点评(可使用) --> <!-- Content: refer to 有品·优惠券 + 点评(可使用) -->
<view class="coupon-list"> <view class="coupon-list" wx:for="{{points}}" wx:for-item="item" wx:key="{{index}}">
<view class="item stamp {{validStatus==true?'stamp01':'stamp06'}}"> <view class="item stamp {{validStatus==true?'stamp01':'stamp06'}}">
<!-- 积分详情 --> <!-- 积分详情 -->
<view class="float-li t1"> <view class="float-li t1">
<view class="coupon-left"> <view class="coupon-left">
<view class="t1"> <view class="t1">
<view class="t1-left">9元</view> <view class="t1-left">
<view class="t1-right">Renaissance Bar优惠积分</view> {{item.total_point}}
</view>
<view class="t1-right">{{item.member_name}}优惠积分</view>
</view> </view>
<!-- <view class="t2"> <!-- <view class="t2">
...@@ -30,15 +32,15 @@ ...@@ -30,15 +32,15 @@
</view> --> </view> -->
<view class="t3"> <view class="t3">
<view class="t3-left">好友助力:助力10人,共4积分</view> <view class="t3-left">好友助力:助力{{item.bonus_count}}人,共{{item.bonus_count}}积分</view>
<view class="t3-right" bindtap="onClickPoints"> <view class="t3-right" bindtap="onClickPoints" data-id='{{index}}'>
<image src="../../../icon/my/points-detail.png"></image> <image src="../../../icon/my/points-detail.png"></image>
</view> </view>
</view> </view>
<view class="t4"> <view class="t4">
<view class="t4-left">优惠券码:264669616164</view> <view class="t4-left">优惠券码:{{item.match_id}}</view>
<view class="t4-right" bindtap="onClickBarcode" hidden="{{validStatus==false?true:false}}"> <view class="t4-right" bindtap="onClickBarcode" data-id='{{index}}' hidden="{{validStatus==false?true:false}}">
<image src="../../../icon/my/logo-barcode.png"></image> <image src="../../../icon/my/logo-barcode.png"></image>
</view> </view>
</view> </view>
...@@ -46,76 +48,6 @@ ...@@ -46,76 +48,6 @@
</view> </view>
</view> </view>
</view> </view>
<view class="item stamp {{validStatus==true?'stamp01':'stamp06'}} ">
<!-- 积分详情 -->
<view class="float-li t1">
<view class="coupon-left">
<view class="t1">
<view class="t1-left">9元</view>
<view class="t1-right">Renaissance Bar优惠积分</view>
</view>
<!-- <view class="t2">
<view class="t2-left">有效期至:2020/07/31 23:59</view>
<view class="t2-right" hidden="{{validStatus==true?true:false}}">
已过期
</view>
</view> -->
<view class="t3">
<view class="t3-left">好友助力:助力10人,共4积分</view>
<view class="t3-right" bindtap="onClickPoints">
<image src="../../../icon/my/points-detail.png"></image>
</view>
</view>
<view class="t4">
<view class="t4-left">优惠券码:264669616164</view>
<view class="t4-right" bindtap="onClickBarcode" hidden="{{validStatus==false?true:false}}">
<image src="../../../icon/my/logo-barcode.png"></image>
</view>
</view>
</view>
</view>
</view>
<view class="item stamp {{validStatus==true?'stamp01':'stamp06'}} ">
<!-- 积分详情 -->
<view class="float-li t1">
<view class="coupon-left">
<view class="t1">
<view class="t1-left">9元</view>
<view class="t1-right">Renaissance Bar优惠积分</view>
</view>
<!-- <view class="t2">
<view class="t2-left">有效期至:2020/07/31 23:59</view>
<view class="t2-right" hidden="{{validStatus==true?true:false}}">
已过期
</view>
</view> -->
<view class="t3">
<view class="t3-left">好友助力:助力10人,共4积分</view>
<view class="t3-right" bindtap="onClickPoints">
<image src="../../../icon/my/points-detail.png"></image>
</view>
</view>
<view class="t4">
<view class="t4-left">优惠券码:264669616164</view>
<view class="t4-right" bindtap="onClickBarcode" hidden="{{validStatus==false?true:false}}">
<image src="../../../icon/my/logo-barcode.png"></image>
</view>
</view>
</view>
</view>
</view>
</view> </view>
<!-- 查看好友助力--> <!-- 查看好友助力-->
...@@ -134,9 +66,9 @@ ...@@ -134,9 +66,9 @@
</view> </view>
<view class="list-point"> <view class="list-point">
<view class="text">Jerry Su助力2积分</view> <view class="text" wx:for="{{bonus_info}}" wx:for-item="item" wx:key="{{index}}" >
<view class="text">小屋助力2积分</view> {{item.user_name}}助力{{item.bonus_point}}积分
<view class="text">zsy助力1.2积分</view> </view>
</view> </view>
</view> </view>
<!-- end 遮罩层 --> <!-- end 遮罩层 -->
...@@ -147,7 +79,7 @@ ...@@ -147,7 +79,7 @@
<!-- start 遮罩层 --> <!-- start 遮罩层 -->
<view class="mask" catchtouchmove="preventTouchMove" wx:if="{{showModalBarcode}}"></view> <view class="mask" catchtouchmove="preventTouchMove" wx:if="{{showModalBarcode}}"></view>
<!-- 弹出层 --> <!-- 弹出层 -->
<view class="modalDlg" style="height: 420rpx;" wx:if="{{showModalBarcode}}"> <view class="modalDlg" wx:if="{{showModalBarcode}}">
<!-- 二维码或其他图片 --> <!-- 二维码或其他图片 -->
<view class="title"> <view class="title">
<text style="color:#666666">请扫描以下券码验券 </text> <text style="color:#666666">请扫描以下券码验券 </text>
...@@ -157,8 +89,8 @@ ...@@ -157,8 +89,8 @@
</view> </view>
<view class="list-barcode"> <view class="list-barcode">
<view class="text">券码:0425 5158 3573</view> <view class="text">券码:{{qrcode}}</view>
<image src="../../../icon/my/barcode.png"></image> <image src="{{qrcode_url}}"></image>
</view> </view>
<view class="list-barcode-image"> <view class="list-barcode-image">
......
.page{ .page{
...@@ -101,7 +101,7 @@ ...@@ -101,7 +101,7 @@
/* 弹出层 */ /* 弹出层 */
.modalDlg{ .modalDlg{
width: 80%; width: 80%;
height: 360rpx; height: 540rpx;
position: fixed; position: fixed;
top: 240rpx; top: 240rpx;
left: 0; left: 0;
...@@ -195,12 +195,13 @@ ...@@ -195,12 +195,13 @@
.list-barcode .text{ .list-barcode .text{
align-items: center; align-items: center;
margin-left: 20rpx;
} }
.list-barcode image{ .list-barcode image{
overflow: visible; overflow: visible;
width: 240rpx; width: 300rpx;
height: 240rpx; height: 300rpx;
} }
/* 弹出层里面的按钮 */ /* 弹出层里面的按钮 */
......
{ {
{ {
"description": "项目配置文件。", "description": "项目配置文件。",
"setting": { "setting": {
"urlCheck": true, "urlCheck": false,
"es6": true, "es6": true,
"postcss": true, "postcss": true,
"minified": true, "minified": true,
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
"disablePlugins": [], "disablePlugins": [],
"outputPath": "" "outputPath": ""
}, },
"useCompilerModule": true, "useCompilerModule": false,
"userConfirmedUseCompilerModuleSwitch": false "userConfirmedUseCompilerModuleSwitch": false
}, },
"compileType": "miniprogram", "compileType": "miniprogram",
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论