Ver código fonte

添加超值增配活动(测试环境)

master
suizhijia 5 anos atrás
pai
commit
bffcbde1b5
18 arquivos alterados com 1481 adições e 14 exclusões
  1. +4
    -4
      496_dongfengqichen/app.js
  2. +3
    -1
      496_dongfengqichen/app.json
  3. +4
    -1
      496_dongfengqichen/pages/component/tabBar/index.js
  4. +5
    -1
      496_dongfengqichen/pages/component/tabBar/index.wxml
  5. +1
    -1
      496_dongfengqichen/pages/index/index.wxml
  6. +216
    -0
      496_dongfengqichen/pages/mountings/mountings.js
  7. +7
    -0
      496_dongfengqichen/pages/mountings/mountings.json
  8. +66
    -0
      496_dongfengqichen/pages/mountings/mountings.wxml
  9. +231
    -0
      496_dongfengqichen/pages/mountings/mountings.wxss
  10. +253
    -0
      496_dongfengqichen/pages/mountingsDetail/mountingsDetail.js
  11. +6
    -0
      496_dongfengqichen/pages/mountingsDetail/mountingsDetail.json
  12. +95
    -0
      496_dongfengqichen/pages/mountingsDetail/mountingsDetail.wxml
  13. +378
    -0
      496_dongfengqichen/pages/mountingsDetail/mountingsDetail.wxss
  14. +1
    -1
      496_dongfengqichen/pages/myCenter/myCenter.js
  15. +17
    -3
      496_dongfengqichen/pages/myCenter/myCenter.wxml
  16. +1
    -1
      496_dongfengqichen/pages/placingOrder/placingOrder.wxml
  17. +1
    -1
      496_dongfengqichen/project.config.json
  18. +192
    -0
      496_dongfengqichen/utils/md5.js

+ 4
- 4
496_dongfengqichen/app.js Ver arquivo

}) })
}, },
globalData: { globalData: {
// urlRoot: "https://dongfengqichen.jiyou-tech.com/",//测试接口根目录
urlRoot: "https://xing.venucia.com/api/",//接口根目录
// urlStatic: "https://www.jiyou-tech.com/2020/496_qichen/static",//测试静态资源根目录
urlStatic: "https://xingb.venucia.com/resource",//静态资源根目录
urlRoot: "https://dongfengqichen.jiyou-tech.com/",//测试接口根目录
// urlRoot: "https://xing.venucia.com/api/",//接口根目录
urlStatic: "https://www.jiyou-tech.com/2020/496_qichen/static",//测试静态资源根目录
// urlStatic: "https://xingb.venucia.com/resource",//静态资源根目录
openid: "",//OPENID openid: "",//OPENID
parentOpenid:"",//推荐人的openid parentOpenid:"",//推荐人的openid
session_key: "",//session_key session_key: "",//session_key

+ 3
- 1
496_dongfengqichen/app.json Ver arquivo

"pages/guessSecondPoster/guessSecondPoster", "pages/guessSecondPoster/guessSecondPoster",
"pages/compute/compute", "pages/compute/compute",
"pages/orderActivity/orderActivity", "pages/orderActivity/orderActivity",
"pages/rotaryDraw/rotaryDraw"
"pages/rotaryDraw/rotaryDraw",
"pages/mountings/mountings",
"pages/mountingsDetail/mountingsDetail"
], ],
"window": { "window": {
"backgroundTextStyle": "light", "backgroundTextStyle": "light",

+ 4
- 1
496_dongfengqichen/pages/component/tabBar/index.js Ver arquivo

// title: '暂未开启', // title: '暂未开启',
// icon:'none' // icon:'none'
// }) // })
// wx.reLaunch({
// url: '/pages/luckyStar/luckyStar'
// })
wx.reLaunch({ wx.reLaunch({
url: '/pages/luckyStar/luckyStar'
url: '/pages/mountings/mountings'
}) })
} else if (page == '4'){ } else if (page == '4'){
wx.reLaunch({ wx.reLaunch({

+ 5
- 1
496_dongfengqichen/pages/component/tabBar/index.wxml Ver arquivo

<image class="tabBar2" src="{{imgUrl+'/tabBar/2_'+(nowPage==2?2:1)+'.png?v=002'}}"></image> <image class="tabBar2" src="{{imgUrl+'/tabBar/2_'+(nowPage==2?2:1)+'.png?v=002'}}"></image>
<view class="tabBarText {{nowPage==2?'tabBarText2':''}}">星探计划</view> <view class="tabBarText {{nowPage==2?'tabBarText2':''}}">星探计划</view>
</view> </view>
<view class="tabBarOption" bindtap="cutPage" data-page="3">
<!-- <view class="tabBarOption" bindtap="cutPage" data-page="3">
<image class="tabBar3" src="{{imgUrl+'/tabBar/3_'+(nowPage==3?2:1)+'.png?v=002'}}"></image> <image class="tabBar3" src="{{imgUrl+'/tabBar/3_'+(nowPage==3?2:1)+'.png?v=002'}}"></image>
<view class="tabBarText {{nowPage==3?'tabBarText2':''}}">玩出惊喜</view> <view class="tabBarText {{nowPage==3?'tabBarText2':''}}">玩出惊喜</view>
</view> -->
<view class="tabBarOption" bindtap="cutPage" data-page="3">
<image class="tabBar3" src="{{imgUrl+'/tabBar/3_'+(nowPage==3?2:1)+'.png?v=002'}}"></image>
<view class="tabBarText {{nowPage==3?'tabBarText2':''}}">超值增配</view>
</view> </view>
<view class="tabBarOption" bindtap="cutPage" data-page="4" style="border:none;"> <view class="tabBarOption" bindtap="cutPage" data-page="4" style="border:none;">
<image class="tabBar4" src="{{imgUrl+'/tabBar/4_'+(nowPage==4?2:1)+'.png?v=002'}}"></image> <image class="tabBar4" src="{{imgUrl+'/tabBar/4_'+(nowPage==4?2:1)+'.png?v=002'}}"></image>

+ 1
- 1
496_dongfengqichen/pages/index/index.wxml Ver arquivo

<!-- <image style="width:750rpx;height:11693rpx;" src="{{imgUrl+'/newImages8/newHome/newHomeBg.png'}}"></image> --> <!-- <image style="width:750rpx;height:11693rpx;" src="{{imgUrl+'/newImages8/newHome/newHomeBg.png'}}"></image> -->
<!-- <image style="width:750rpx;height:10368rpx;" src="{{imgUrl+'/newImages4/16.png'}}"></image> --> <!-- <image style="width:750rpx;height:10368rpx;" src="{{imgUrl+'/newImages4/16.png'}}"></image> -->
<image style="width:750rpx;height:1600rpx;" src="{{imgUrl+'/newImages6/images/newImg_01.png?v=002'}}"></image> <image style="width:750rpx;height:1600rpx;" src="{{imgUrl+'/newImages6/images/newImg_01.png?v=002'}}"></image>
<image style="width:750rpx;height:1600rpx;" src="{{imgUrl+'/newImages6/images/newImg_02.png?v=008'}}"></image>
<image style="width:750rpx;height:1600rpx;" src="{{imgUrl+'/newImages9/24.png'}}"></image>
<image style="width:750rpx;height:1600rpx;" src="{{imgUrl+'/newImages6/images/newImg_03.png'}}"></image> <image style="width:750rpx;height:1600rpx;" src="{{imgUrl+'/newImages6/images/newImg_03.png'}}"></image>
<image style="width:750rpx;height:1600rpx;" src="{{imgUrl+'/newImages6/images/newImg_04.png'}}"></image> <image style="width:750rpx;height:1600rpx;" src="{{imgUrl+'/newImages6/images/newImg_04.png'}}"></image>
<image style="width:750rpx;height:1600rpx;" src="{{imgUrl+'/newImages6/images/newImg_05.png'}}"></image> <image style="width:750rpx;height:1600rpx;" src="{{imgUrl+'/newImages6/images/newImg_05.png'}}"></image>

+ 216
- 0
496_dongfengqichen/pages/mountings/mountings.js Ver arquivo

// pages/mountings/mountings.js
const app = getApp();
Page({
/**
* 页面的初始数据
*/
data: {
imgUrl: app.globalData.urlStatic,//图片路径
activityRule:false,//是否显示活动规则
dataList:[],//数据列表
userInfoData:false,//是否已获取用户头像昵称
isAddress:false,//是否有地址
addressShow:false,
dateList:[],//日期列表
dateChoose:'',//当前日的活动列表
},

/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
app.globalData.nowPage = 3;
if (app.globalData.openid) {
this.loadFun();
} else {
app.globalData.openidSuccessFuc = this.loadFun;
}
},
loadFun: function () {
this.detectionUserMsg();
this.getAddress();
},

/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {

},

/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
this.getActivityDate();
},

/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {

},

/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {

},

/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {

},

/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {

},

/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
return {
title: '我正在参与启辰星秒杀增配活动,一起来秒杀!',
imageUrl: this.data.imgUrl+'/newImages9/13.png',
path: "/pages/mountings/mountings"
}
},
ruleShowControl(){//控制活动规则的显示与隐藏
this.setData({
activityRule:!this.data.activityRule
})
},
detectionUserMsg(){//检测是否已获取用户头像昵称
if(app.globalData.userInfoData && app.globalData.userInfoData.avatarUrl){
this.setData({
userInfoData:true
})
}else{
app.globalData.userInfoSuccessFuc = this.detectionUserMsg;
}
},
getAddress: function () {//获取地址
app.wxRequest(app.globalData.urlRoot + "address/getAddressV2", {}, res => {
if (res.code == 200) {
if (res.data) {
this.data.isAddress = true;
}
}
}, this)
},
joinActivity(e){
let state = e.target.dataset.state;
let index = e.target.dataset.index;
if(state==-1){//我要砍价
if(this.data.isAddress){
this.beginBargain(this.data.dataList[index]);
}else{
this.setData({
addressShow: true
})
}
}else if(state==0){//查看详情
wx.navigateTo({
url: '/pages/mountingsDetail/mountingsDetail?datas='+JSON.stringify(this.data.dataList[index]),
})
}else if(state==1){//已经成功
wx.reLaunch({
url: '/pages/myCenter/myCenter'
})
}
},
beginBargain(data){//发起砍价活动
app.wxRequest(app.globalData.urlRoot + "bargain/beginBargain", {activity_id:data.id}, res => {
if (res.code == 200) {
data.activity_token = res.data.activity_token;
wx.navigateTo({
url: '/pages/mountingsDetail/mountingsDetail?datas='+JSON.stringify(data),
})
}else{
wx.showToast({
title: res.msg,
icon: "none"
})
}
}, this,"POST");
},
getUserWxMsg:function(e){//通过微信获取用户信息
if (e.detail.errMsg == "getUserInfo:ok") {
app.globalData.userInfoData = {};
app.globalData.userInfoData.avatarUrl = e.detail.userInfo.avatarUrl;
app.globalData.userInfoData.nickName = e.detail.userInfo.nickName;
this.setData({
userInfoData: true
})
app.submitUserMsg(e.detail.userInfo.avatarUrl, e.detail.userInfo.nickName);
if(this.data.isAddress){
wx.navigateTo({
url: '/pages/mountingsDetail/mountingsDetail',
})
}else{
this.setData({
addressShow: true
})
}
}
},
addressControl: function () {//跳转到地址管理
this.setData({
addressShow: !this.data.addressShow
})
if(!this.data.isAddress){
this.getAddress();
}
},
getActivityDate:function(){//获取展示日期
app.wxRequest(app.globalData.urlRoot + "bargain/getActivityDate", {}, res => {
if (res.code == 200) {
for(let i=0;i<res.data.length;i++){
let date = res.data[i]['activity_date'].split('-');
res.data[i]['activity_date_show'] = date[1]+'月'+date[2]+'日';
}
if(res.data[0]){
this.setData({
dateChoose:res.data[0]['activity_date']
})
this.getActivityList();
this.setData({
dateList:res.data
})
}
}
}, this);
},
getActivityList:function(){//获取某日的活动列表
app.wxRequest(app.globalData.urlRoot + "bargain/getActivityList", {activity_date:this.data.dateChoose}, res => {
if (res.code == 200) {
for(let i=0;i<res.data.list.length;i++){
res.data.list[i]['goods_origin_price2'] = res.data.list[i]['goods_origin_price']/100;//原价(单位:分改为元)
res.data.list[i]['goods_final_price2'] = res.data.list[i]['goods_final_price']/100;//底价(单位:分改为元)
res.data.list[i]['goods_surplus_num'] = res.data.list[i]['goods_total_num']-res.data.list[i]['goods_success_num'];//剩余数量
res.data.list[i]['consumeNum'] = Math.ceil((1-res.data.list[i]['goods_surplus_num']/res.data.list[i]['goods_total_num'])*100);//已抢进度
}
this.setData({
dataList:res.data.list
})
}
}, this);
},
dateChange(e){//选中日期发生改变
var index = e.currentTarget.dataset.index;
if(this.data.dateChoose != this.data.dateList[index]['activity_date']){
this.setData({
dateChoose:this.data.dateList[index]['activity_date']
})
this.getActivityList();
}
}
})

+ 7
- 0
496_dongfengqichen/pages/mountings/mountings.json Ver arquivo

{
"navigationBarTitleText": "超值增配",
"usingComponents": {
"tabBar": "../component/tabBar/index",
"userMsg": "/pages/userMsg/userMsg"
}
}

+ 66
- 0
496_dongfengqichen/pages/mountings/mountings.wxml Ver arquivo

<!--pages/mountings/mountings.wxml-->
<view class="all">
<view class="main">
<image class="newImages9-1" src="{{imgUrl+'/newImages9/1.png'}}"></image>
<image class="newImages9-2" bindtap="ruleShowControl" src="{{imgUrl+'/newImages9/2.png'}}"></image>
<image class="newImages9-3" src="{{imgUrl+'/newImages9/3.png'}}"></image>
<image class="newImages9-4" src="{{imgUrl+'/newImages9/4.png'}}"></image>
<view class="activity-phases">
<view style="width:65rpx;height:55rpx;padding-right:20rpx;">
<image class="newImages9-5" src="{{imgUrl+'/newImages9/5.png'}}"></image>
</view>
<view class="phases-group" wx:for="{{dateList}}" wx:key="index" bindtap="dateChange" data-index="{{index}}">
<view class="date-text date-choose" wx:if="{{index == 0}}">{{item.activity_date_show}}</view>
<view class="date-text" wx:else>{{item.activity_date_show}}</view>
<image class="newImages9-11" wx:if="{{index == 0}}" src="{{imgUrl+'/newImages9/11.png'}}"></image>
<view class="phases-state" wx:elif="{{index == 1}}">即将开始</view>
<view class="phases-state" wx:else>敬请期待</view>
</view>
</view>
<view class="goods-frame">
<view class="goods-group" wx:for="{{dataList}}" wx:key="index">
<view class="goods-img">
<image src="{{item.sku_thumbnail_pic}}" style="width:100%;height:100%;" mode="aspectFit"></image>
</view>
<view class="goods-detail">
<view class="goods-title">{{item.sku_name}}</view>
<view class="goods-detail-data">
<view>
<!-- <view class="goods-price">原价:¥{{item.goods_origin_price2}}</view> -->
<view class="goods-price">{{item.goods_origin_content}}</view>
<view class="bar-group">
<view class="bar-num" style="width:{{item.consumeNum}}%;"></view>
<view class="away-text">已抢{{item.consumeNum}}%</view>
</view>
<view class="goods-surplus">剩余<text class="surplus-num">{{item.goods_surplus_num}}</text>件</view>
</view>
<view style="margin-top:14rpx;margin-left:66rpx;position:relative;">
<!-- <view wx:if="{{item.state==-1}}" class="after-discount">券后:¥<text style="font-size:37rpx;">{{item.goods_final_price2}}</text></view> -->
<view wx:if="{{item.state==-1}}" class="after-discount">{{item.goods_final_content}}</view>
<!-- <view wx:if="{{item.state!=-1}}" class="after-discount" style="color:#2B2B2B;">券后:¥<text style="font-size:37rpx;">{{item.goods_final_price2}}</text></view> -->
<view wx:if="{{item.state!=-1}}" class="after-discount" style="color:#2B2B2B;">{{item.goods_final_content}}</view>
<image wx:if="{{item.state==-1 && dateChoose==dateList[0]['activity_date']}}" bindtap="joinActivity" data-index="{{index}}" data-state="{{item.state}}" class="newImages9-6" src="{{imgUrl+'/newImages9/6.png'}}"></image>
<image wx:if="{{item.state==0 && dateChoose==dateList[0]['activity_date']}}" bindtap="joinActivity" data-index="{{index}}" data-state="{{item.state}}" class="newImages9-6" src="{{imgUrl+'/newImages9/7.png'}}"></image>
<image wx:if="{{item.state==1 && dateChoose==dateList[0]['activity_date']}}" bindtap="joinActivity" data-index="{{index}}" data-state="{{item.state}}" class="newImages9-6" src="{{imgUrl+'/newImages9/8.png'}}"></image>
<image wx:if="{{item.state==-2 && dateChoose==dateList[0]['activity_date']}}" bindtap="joinActivity" data-index="{{index}}" data-state="{{item.state}}" class="newImages9-6" src="{{imgUrl+'/newImages9/9.png'}}"></image>
<image wx:if="{{dateChoose!=dateList[0]['activity_date']}}" class="newImages9-6" src="{{imgUrl+'/newImages9/25.png'}}"></image>
<view class="newImages9-6 btns" wx:if="{{!userInfoData && item.state==-1}}">
<button style="min-height:0rpx;width:100%;height:100%;" open-state="getUserInfo" bindgetuserinfo="getUserWxMsg"></button>
</view>
</view>
</view>
</view>
</view>
<!-- <image class="newImages9-10" src="{{imgUrl+'/newImages9/10.png'}}"></image> -->
</view>
<view class="ruleFrame" wx:if="{{activityRule}}">
<view class="titleText">活动规则</view>
<view class="lineSty"></view>
<image class="closeXieyi" bindtap="ruleShowControl" src="{{imgUrl+'/images/closeXieyi.png'}}"></image>
<image class="newImages9-12" src="{{imgUrl+'/newImages9/12.png'}}"></image>
</view>
</view>
<userMsg bindaddress="addressControl" wx:if="{{addressShow}}"></userMsg>
<tabBar></tabBar>
</view>


+ 231
- 0
496_dongfengqichen/pages/mountings/mountings.wxss Ver arquivo

/* pages/mountings/mountings.wxss */
page{
background-color: #EDEDED;
}
image{
display: block;
}
view{
-webkit-overflow-scrolling: touch;
}
.main{
height: calc(100vh - 120rpx);
overflow: auto;
}
.newImages9-1{
width: 750rpx;
height: 556rpx;
}
.newImages9-2{
position: absolute;
top: 165rpx;
right: 3rpx;
width: 87rpx;
height: 88rpx;
}
.newImages9-3{
width: 308rpx;
height: 24rpx;
margin: 34rpx auto 13rpx;
}
.newImages9-4{
width: 540rpx;
height: 57rpx;
margin: 0 auto;
}
.activity-phases{
width: 750rpx;
height: 84rpx;
background-color: white;
margin-top: 52rpx;
padding-left: 27rpx;
box-sizing: border-box;
display: flex;
align-items: center;
overflow-y: hidden;
white-space: nowrap;
}
.activity-phases::-webkit-scrollbar{
display: none;
}
.newImages9-5{
width: 65rpx;
height: 55rpx;
}
.phases-group{
margin-right: 80rpx;
}
.phases-group:last-of-type{
margin-right: 0;
padding-right: 27rpx;
}
.date-text{
font-size:24rpx;
font-family:NissanBrand;
font-weight:400;
color:rgba(89,87,87,1);
}
.date-choose{
font-weight:bold;
color:rgba(236,39,13,1);
}
.newImages9-11{
width:74rpx;
height:27rpx;
margin: 0 auto;
}
.phases-state{
text-align: center;
font-size:18rpx;
font-family:MHeiPRC;
font-weight:500;
color:rgba(89,87,87,1);
}
.goods-frame{
padding: 59rpx 21rpx 38rpx;
}
.goods-group{
margin-bottom: 31rpx;
width: 100%;
height: 261rpx;
background-color: white;
border-radius: 20rpx;
display: flex;
padding-top: 19rpx;
padding-left: 19rpx;
box-sizing: border-box;
}
.goods-img{
width: 220rpx;
height: 220rpx;
border: 1rpx solid #D3D3D3;
border-radius: 20rpx;
overflow: hidden;
}
.goods-detail{
padding-top: 14rpx;
margin-left: 20rpx;
}
.goods-title{
width: 400rpx;
font-size: 28rpx;
font-weight: bold;
color: black;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.goods-detail-data{
margin-top: 48rpx;
display: flex;
}
.goods-price{
font-size:22rpx;
font-family:MHeiPRC;
font-weight:bold;
color:rgba(125,125,125,1);
}
.bar-group{
position: relative;
width:190rpx;
height:23rpx;
background-color: #EDEDED;
margin-top: 7rpx;
margin-bottom: 22rpx;
border-radius: 20rpx;
overflow: hidden;
}
.bar-num{
position: absolute;
left: 0;
top: 0;
height: 100%;
width: 100%;
background-color: #EE3212;
}
.away-text{
position: absolute;
width: 100%;
top: 50%;
transform: translateY(-50%);
left: 10rpx;
font-size:14rpx;
font-family:MHeiPRC;
font-weight:500;
color:rgba(255,255,255,1);
}
.goods-surplus{
font-size:22rpx;
font-family:MHeiPRC;
font-weight:bold;
color:rgba(125,125,125,1);
}
.surplus-num{
color: #EE3212;
}
.after-discount{
font-size:22rpx;
font-family:MHeiPRC;
font-weight:500;
color:#355483;
text-align: right;
}
.newImages9-6{
width: 161rpx;
height: 58rpx;
margin-top: 5rpx;
}
.newImages9-10{
width: 710rpx;
height: 70rpx;
margin: 0 auto;
margin-top: 70rpx;
}
.ruleFrame{
position: absolute;
left: 0;
top: 0;
width: 100%;
height: calc(100vh - 120rpx);
background-color: white;
overflow: auto;
padding-bottom: 130rpx;
box-sizing: border-box;
}
.titleText{
width: 682rpx;
margin: 0 auto;
margin-top: 78rpx;
margin-bottom: 28rpx;
line-height: 39rpx;
font-size:39rpx;
font-family:PingFangSC;
font-weight:bold;
color:rgba(0,77,149,1);
}
.lineSty{
width: 682rpx;
height:2rpx;
background-color: #B6B6B6;
margin: 0 auto;
margin-bottom: 45rpx;
}
.closeXieyi{
position: absolute;
right: 48rpx;
top: 38rpx;
width: 42rpx;
height: 42rpx;
}
.newImages9-12{
width: 641rpx;
height: 1037rpx;
margin: 0 auto;
margin-top: 40rpx;
}
.btns{
position: absolute;
left: 0;
bottom: 0;
opacity: 0;
}

+ 253
- 0
496_dongfengqichen/pages/mountingsDetail/mountingsDetail.js Ver arquivo

// pages/mountingsDetail/mountingsDetail.js
const app = getApp();
let _surplusTime = 0;//剩余时间
let _countTime = null;//定时器
let md5 = require('../../utils/md5.js');
Page({

/**
* 页面的初始数据
*/
data: {
imgUrl: app.globalData.urlStatic,//图片路径
activityRule:false,//是否显示活动规则
surplusTime:['','',''],//剩余时间
bargainType:1,//1:喊朋友帮忙砍价,2:帮TA砍一刀
userInfoData:false,//是否已获取用户头像昵称
helpDickerShow:false,//是否显示帮助朋友砍价成功的弹窗
friendBargain:[],//好友助力列表
goodsMsg:{},
goodsDetail:{},//商品详情
activityJoinDetail:{},//活动进度详情
friendHelpMoney:0,//朋友帮忙砍的价格
page:1,
count:10,
ismore:true,//是否还有更多数据
},

/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
if(options.bargainType){
this.setData({
bargainType:2
})
}
if(options.datas){
this.data.goodsMsg = JSON.parse(options.datas);
}
app.globalData.nowPage = 3;
if (app.globalData.openid) {
this.loadFun();
} else {
app.globalData.openidSuccessFuc = this.loadFun;
}
},
loadFun: function () {
// let countNum = 60*60*24;
// let hours = new Date().getHours();
// let minutes = new Date().getMinutes();
// let seconds = new Date().getSeconds();
// _surplusTime = countNum-(60*60*hours+60*minutes+seconds);
this.detectionUserMsg();
this.getGoodsDetail();
this.getActivityJoinDetail();
this.getFriendBargainList();
},

/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},

/**
* 生命周期函数--监听页面显示
*/
onShow: function () {

},

/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {

},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
clearInterval(_countTime);
},

/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},

/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},

/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
return {
title: "我正在以超低价购买"+this.data.goodsMsg.sku_name+"!有你帮忙还能更便宜!快来帮我!",
imageUrl: this.data.imgUrl+'/newImages9/13.png',
path: "/pages/mountingsDetail/mountingsDetail?bargainType=2&datas="+JSON.stringify(this.data.goodsMsg)
}
},
ruleShowControl(){//控制活动规则的显示与隐藏
this.setData({
activityRule:!this.data.activityRule
})
},
countDown(){//倒计时
_countTime = setInterval(() => {
if(_surplusTime){
_surplusTime--;
this.timeDispose();
}else{
clearInterval(_countTime);
// _surplusTime = 60*60*24;
}
}, 1000);
},
timeDispose(){//时间处理
let hours = Math.floor(_surplusTime/3600);
let minutes = Math.floor(_surplusTime%3600/60);
let seconds = Math.floor(_surplusTime%3600%60);
this.data.surplusTime[0] = hours>=10?hours:'0'+hours
this.data.surplusTime[1] = minutes>=10?minutes:'0'+minutes
this.data.surplusTime[2] = seconds>=10?seconds:'0'+seconds
this.setData({
surplusTime:this.data.surplusTime
})
},
enterListPage(){//进入列表页
if(this.data.bargainType==1){
wx.navigateBack({
delta:1
})
}else{
wx.redirectTo({
url: '/pages/mountings/mountings'
})
}
},
detectionUserMsg(){//检测是否已获取用户头像昵称
if(app.globalData.userInfoData && app.globalData.userInfoData.avatarUrl){
this.setData({
userInfoData:true
})
}else{
app.globalData.userInfoSuccessFuc = this.detectionUserMsg;
}
},
getUserWxMsg:function(e){//通过微信获取用户信息
if (e.detail.errMsg == "getUserInfo:ok") {
app.globalData.userInfoData = {};
app.globalData.userInfoData.avatarUrl = e.detail.userInfo.avatarUrl;
app.globalData.userInfoData.nickName = e.detail.userInfo.nickName;
this.setData({
userInfoData: true
})
app.submitUserMsg(e.detail.userInfo.avatarUrl, e.detail.userInfo.nickName);
this.bargainByFriend();
}
},
helpFriend(){//帮朋友砍一刀
this.setData({
helpDickerShow:!this.data.helpDickerShow
})
},
getFriendBargainList(){//获取好友助力列表
app.wxRequest(app.globalData.urlRoot + "bargain/getFriendBargainList", {activity_token:this.data.goodsMsg.activity_token,page:this.data.page,count:this.data.count}, res => {
if (res.code == 200) {
for(let i=0;i<res.data.list.length;i++){
res.data.list[i]['reduce_money'] = res.data.list[i]['reduce_money']/100;
this.data.friendBargain.push(res.data.list[i]);
}
this.setData({
friendBargain:this.data.friendBargain
})
if(this.data.friendBargain.length>=res.data.total){
this.data.ismore = false;
}
}
}, this);
},
bargainByFriend(){//好友发起助力
let openid = app.globalData.openid;//openid
let activity_token = this.data.goodsMsg.activity_token;//activity_token
let timestamp = Date.parse(new Date())/1000;//当前时间戳(秒)
let fixedString = "bargain_dongfeng";//固定字符串
let signStr = openid+activity_token+timestamp+fixedString
let sign = md5.hexMD5(signStr)
app.wxRequest(app.globalData.urlRoot + "bargain/bargainByFriend", {activity_token:activity_token,timestamp:timestamp,sign:sign}, res => {
console.log(res);
if (res.code == 200) {
this.setData({
friendHelpMoney:res.data.bargainMoney/100
})
this.helpFriend();
}else{
wx.showToast({
title:res.msg,
icon:"none"
})
}
}, this,"POST");
},
getGoodsDetail(){//获取商品详情
app.wxRequest(app.globalData.urlRoot + "bargain/getGoodsDetail", {sku_id:this.data.goodsMsg.sku_id}, res => {
if (res.code == 200) {
this.setData({
goodsDetail:res.data
})
}else{
wx.showToast({
title:res.msg,
icon:"none"
})
}
}, this);
},
getActivityJoinDetail(){//获取砍价活动进度详情
app.wxRequest(app.globalData.urlRoot + "bargain/getActivityJoinDetail", {activity_token:this.data.goodsMsg.activity_token}, res => {
if (res.code == 200) {
res.data.gap_money = res.data.gap_money/100;
res.data.success_money = res.data.success_money/100;
res.data.surplus = res.data.gap_money-res.data.success_money;
res.data.percent = Math.ceil((1-res.data.surplus/res.data.gap_money)*100);
this.setData({
activityJoinDetail:res.data
})
_surplusTime = res.data.lastTime;
this.timeDispose();
this.countDown();
}else{
wx.showToast({
title:res.msg,
icon:"none"
})
}
}, this);
},
lookMore(){
if(this.data.ismore){
this.data.page++;
this.getFriendBargainList();
}
}
})

+ 6
- 0
496_dongfengqichen/pages/mountingsDetail/mountingsDetail.json Ver arquivo

{
"navigationBarTitleText": "超值增配",
"usingComponents": {
"tabBar": "../component/tabBar/index"
}
}

+ 95
- 0
496_dongfengqichen/pages/mountingsDetail/mountingsDetail.wxml Ver arquivo

<!--pages/mountingsDetail/mountingsDetail.wxml-->
<view class="all">
<view>
<scroll-view class="main" scroll-y="{{true}}" bindscrolltolower="lookMore">
<view class="banner-group">
<swiper indicator-dots="true" style="width:750rpx;height:556rpx;">
<swiper-item wx:for="{{goodsDetail.sku_banner}}" wx:key="index">
<image class="newImages9-test2" src="{{item}}"></image>
</swiper-item>
</swiper>
<view class="goods-price">
<image class="newImages9-14" src="{{imgUrl+'/newImages9/14.png?v=002'}}"></image>
<view class="price-detail">
<view>
<view class="goods-name">{{goodsDetail.sku_name}}</view>
<view style="display:flex;">
<view class="after-discount">{{goodsDetail.goods_final_content}}</view>
<view class="original-price">{{goodsDetail.goods_origin_content}}</view>
</view>
</view>
<image wx:if="{{goodsDetail.goods_detail_right_pic}}" class="newImages9-test3" src="{{goodsDetail.goods_detail_right_pic}}" mode="aspectFit"></image>
</view>
</view>
</view>
<image class="newImages9-2" bindtap="ruleShowControl" src="{{imgUrl+'/newImages9/2.png'}}"></image>
<view class="surplus-time">
<view>还剩:</view>
<view class="time-group">
<view class="time-block">{{surplusTime[0]}}</view>:
<view class="time-block">{{surplusTime[1]}}</view>:
<view class="time-block">{{surplusTime[2]}}</view>
</view>
<view>结束</view>
</view>
<view class="bargain-group">
<view class="bargain-num">已砍<text style="color:#EE3212;font-size:48rpx;">{{activityJoinDetail.success_money}}</text>元,仅差<text style="color:#EE3212;font-size:48rpx;">{{activityJoinDetail.surplus}}</text>元免费拿!</view>
<view class="bargain-bar">
<view class="bar-num" style="width:{{activityJoinDetail.percent}}%;">
<view class="bar-text">{{activityJoinDetail.percent}}%</view>
<image class="newImages9-15" src="{{imgUrl+'/newImages9/15.png'}}"></image>
</view>
</view>
<view class="newImages9-16" wx:if="{{bargainType==1}}">
<image style="width:100%;height:100%;" src="{{imgUrl+'/newImages9/18.png'}}"></image>
<button class="btns" style="min-height:0rpx;width:100%;height:100%;" open-type="share"></button>
</view>
<view class="newImages9-16" wx:if="{{bargainType==2}}">
<image bindtap="bargainByFriend" class="newImages9-16" src="{{imgUrl+'/newImages9/16.png'}}"></image>
<button wx:if="{{!userInfoData}}" class="btns" style="min-height:0rpx;width:100%;height:100%;" open-type="getUserInfo" bindgetuserinfo="getUserWxMsg"></button>
</view>
</view>
<view style="padding:32rpx 0;">
<view class="bargain-record">
<view class="record-title">
<view class="title-text">砍价记录<view class="white-triangle"></view></view>
<view class="title-line"></view>
<view class="title-text" bindtap="enterListPage">查看更多抄底价商品</view>
</view>
<view class="help-group" wx:for="{{friendBargain}}" wx:key="index">
<view style="display:flex;align-items:center;">
<view class="head-group">
<image src="{{item.avatarUrl}}" class="head-img" mode="aspectFill"></image>
</view>
<view>
<view class="friend-name">{{item.nickName}}</view>
<view class="reason">好友助力狂砍一刀</view>
</view>
</view>
<view style="display:flex;align-items:center;">
<image class="newImages9-17" src="{{imgUrl+'/newImages9/17.png'}}"></image>
<view class="minus-num">砍掉{{item.reduce_money}}元</view>
</view>
</view>
</view>
</view>
<view class="maskFrame" wx:if="{{helpDickerShow}}">
<view class="maskGroup">
<image class="newImages9-19" src="{{imgUrl+'/newImages9/19.png?v=002'}}"></image>
<view class="dicker-money">成功砍价<text style="color:#B60005;">{{friendHelpMoney}}</text>元</view>
<view class="help-confirm" bindtap="helpFriend"></view>
<image class="newImages9-20" bindtap="helpFriend" src="{{imgUrl+'/newImages9/20.png'}}"></image>
</view>
</view>
<view class="ruleFrame" wx:if="{{activityRule}}">
<view class="titleText">活动规则</view>
<view class="lineSty"></view>
<image class="closeXieyi" bindtap="ruleShowControl" src="{{imgUrl+'/images/closeXieyi.png'}}"></image>
<image class="newImages9-12" src="{{imgUrl+'/newImages9/12.png'}}"></image>
</view>
</scroll-view>
</view>
<tabBar></tabBar>
</view>



+ 378
- 0
496_dongfengqichen/pages/mountingsDetail/mountingsDetail.wxss Ver arquivo

/* pages/mountingsDetail/mountingsDetail.wxss */
page{
background-color: #F1F1F1;
}
image{
display: block;
}
view{
-webkit-overflow-scrolling: touch;
}
.main{
height: calc(100vh - 120rpx);
overflow: auto;
}
.banner-group{
position: relative;
width: 750rpx;
height: 556rpx;
}
.newImages9-test2{
width: 100%;
height: 100%;
}
.newImages9-2{
position: absolute;
top: 165rpx;
right: 3rpx;
width: 87rpx;
height: 88rpx;
}
.goods-price{
position: absolute;
left: 0;
bottom: 0;
width: 750rpx;
height: 111rpx;
}
.newImages9-14{
width: 100%;
height: 100%;
}
.price-detail{
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
padding:0 30rpx;
box-sizing: border-box;
display: flex;
align-items: center;
justify-content: space-between;
}
.goods-name{
font-size:30rpx;
font-family:MHeiPRC;
font-weight:bold;
color:rgba(255,255,255,1);
line-height:32rpx;
margin-bottom: 18rpx;
}
.after-discount{
font-size:20rpx;
font-family:MHeiPRC;
font-weight:bold;
color:rgba(255,65,5,1);
line-height:27rpx;
height:27rpx;
padding:0 10rpx;
background-color: white;
border-radius: 5rpx;
}
.original-price{
line-height:27rpx;
font-size:18rpx;
font-family:MHeiPRC;
font-weight:500;
color:rgba(255,255,255,1);
margin-left: 10rpx;
text-decoration: line-through;
}
.surplus-time{
font-size:37rpx;
font-family:MHeiPRC;
font-weight:bold;
color:rgba(35,24,21,1);
line-height:37rpx;
margin-top: 50rpx;
margin-bottom: 35rpx;
display: flex;
align-items: center;
justify-content: center;
}
.time-group{
padding-left: 22rpx;
padding-right: 15rpx;
display: flex;
align-items: center;
justify-content: center;
font-size:26rpx;
}
.time-block{
width:39rpx;
height:39rpx;
background-color: black;
border-radius: 8rpx;
font-family:MHeiPRC;
font-weight:bold;
color:rgba(255,255,255,1);
line-height:39rpx;
text-align: center;
}
.bargain-group{
width:694rpx;
height:330rpx;
border-radius: 20rpx;
margin: 0 auto;
background-color: white;
box-sizing: border-box;
}
.bargain-num{
font-size:28rpx;
font-family:MHeiPRC;
font-weight:bold;
color:rgba(89,87,87,1);
text-align: center;
padding-top: 51rpx;
}
.bargain-bar{
position: relative;
width:576rpx;
height:36rpx;
border: 2rpx solid #4296CB;
border-radius: 20rpx;
margin: 0 auto;
margin-top: 36rpx;
margin-bottom: 28rpx;
overflow: hidden;
}
.bar-num{
position: absolute;
top: 50%;
transform: translateY(-50%);
left: 3rpx;
background-image: linear-gradient(to right,#209BDB,#2278CC);
max-width: 570rpx;
width:0%;
height:30rpx;
border-radius: 20rpx;
display: flex;
align-items: center;
justify-content: flex-end;
}
.bar-text{
line-height: 30rpx;
font-size:18rpx;
font-family:NissanBrand;
font-weight:400;
color:rgba(255,255,255,1);
}
.newImages9-15{
width: 15rpx;
height: 15rpx;
margin-right: 20rpx;
margin-left: 5rpx;
}
.bar-surplus{
position: absolute;
top: 0;
right: 15rpx;
line-height: 36rpx;
font-size:18rpx;
font-family:NissanBrand;
font-weight:400;
color:rgba(35,24,21,1);
}
.newImages9-16{
position: relative;
width: 589rpx;
height: 84rpx;
margin: 0 auto;
}
.bargain-record{
width:694rpx;
background-image: linear-gradient(to right,#209BDB,#2278CC);
margin: 0 auto;
border-radius: 20rpx;
overflow: hidden;
}
.record-title{
position: relative;
width: 100%;
height: 94rpx;
display: flex;
align-items: center;
font-size:30rpx;
font-family:MHeiPRC;
font-weight:500;
color:rgba(255,255,255,1);
line-height: 94rpx;
}
.title-text{
position: relative;
width: 50%;
text-align: center;
}
.title-line{
position: absolute;
left: 50%;
top: 50%;
width: 2rpx;
height: 45rpx;
transform: translate(-50%,-50%);
background-color: white;
}
.white-triangle{
position: absolute;
left: 50%;
transform: translateX(-50%);
bottom: 0;
width: 0;
height: 0;
border: 20rpx solid transparent;
border-bottom-color: white;
}
.help-group{
background-color: white;
width:694rpx;
height:183rpx;
display: flex;
align-items: center;
justify-content:space-between;
padding:0 30rpx;
box-sizing: border-box;
}
.head-group{
border-radius: 50%;
border: 2rpx solid #355483;
width: 79rpx;
height: 79rpx;
overflow: hidden;
margin-right: 15rpx;
}
.head-img{
width: 100%;
height: 100%;
}
.friend-name{
line-height: 30rpx;
font-size:30rpx;
font-family:NissanBrand;
font-weight:bold;
color:rgba(89,87,87,1);
}
.reason{
margin-top: 13rpx;
line-height: 24rpx;
font-size:24rpx;
font-family:MHeiPRC;
font-weight:500;
color:rgba(89,87,87,1);
}
.newImages9-17{
width: 52rpx;
height: 43rpx;
}
.minus-num{
line-height: 30rpx;
font-size:30rpx;
font-family:MHeiPRC;
font-weight:500;
color:rgba(53,84,131,1);
}
.ruleFrame{
position: absolute;
left: 0;
top: 0;
width: 100%;
height: calc(100vh - 120rpx);
background-color: white;
overflow: auto;
padding-bottom: 130rpx;
box-sizing: border-box;
}
.titleText{
width: 682rpx;
margin: 0 auto;
margin-top: 78rpx;
margin-bottom: 28rpx;
line-height: 39rpx;
font-size:39rpx;
font-family:PingFangSC;
font-weight:bold;
color:rgba(0,77,149,1);
}
.lineSty{
width: 682rpx;
height:2rpx;
background-color: #B6B6B6;
margin: 0 auto;
margin-bottom: 45rpx;
}
.closeXieyi{
position: absolute;
right: 48rpx;
top: 38rpx;
width: 42rpx;
height: 42rpx;
}
.newImages9-12{
width: 641rpx;
height: 1037rpx;
margin: 0 auto;
margin-top: 40rpx;
}
.newImages9-test3{
width:247rpx;
height: 75rpx;
}
.btns{
position: absolute;
left: 0;
bottom: 0;
opacity: 0;
}
.maskFrame{
position: fixed;
left: 0;
top: 0;
width: 100%;
height: calc(100vh - 120rpx);
background-color: rgba(000, 000, 000, 0.5);
display: flex;
align-items: center;
justify-content: center;
}
.maskGroup{
position: relative;
width: 603rpx;
height: 500rpx;
}
.newImages9-19{
width: 100%;
height: 100%;
}
.help-confirm{
position: absolute;
left: 50%;
transform: translateX(-50%);
top: 372rpx;
width: 347rpx;
height: 62rpx;
}
.newImages9-20{
position: absolute;
top: -18rpx;
right: -19rpx;
width: 38rpx;
height: 36rpx;
}
.dicker-money{
position: absolute;
left: 0;
top: 260rpx;
width: 100%;
text-align: center;
font-size:36rpx;
font-family:PingFangSC;
font-weight:400;
color:rgba(52,84,128,1);
line-height:36rpx;
}


.wx-swiper-dots{
margin-bottom: 110rpx;
}


+ 1
- 1
496_dongfengqichen/pages/myCenter/myCenter.js Ver arquivo

this.machineHide(); this.machineHide();
}else if(this.data.couponList[index].couponId=="177275"){ }else if(this.data.couponList[index].couponId=="177275"){
this.upgradeHide(); this.upgradeHide();
}else if(this.data.couponList[index].couponId=="179478"){
}else if(this.data.couponList[index].couponId=="179478" || this.data.couponList[index].couponId=="190895"){
this.starMoveHide(); this.starMoveHide();
}else if(this.data.couponList[index].couponId=="185379"){ }else if(this.data.couponList[index].couponId=="185379"){
this.cashHide1(); this.cashHide1();

+ 17
- 3
496_dongfengqichen/pages/myCenter/myCenter.wxml Ver arquivo

</scroll-view> </scroll-view>
</view> </view>
<view class="orderDescGroup" wx:if="{{selectNow==4 && !couponList.length && !couponListState}}"> <view class="orderDescGroup" wx:if="{{selectNow==4 && !couponList.length && !couponListState}}">
<image class="orderDesc" src="{{imgUrl+'/newImages6/52.png?s=004'}}"></image>
<image class="orderDesc" src="{{imgUrl+'/newImages9/21.png'}}"></image>
<image class="indexOrderIcon" bindtap="placingControl" src="{{imgUrl+'/images/indexOrderIcon.png'}}"></image> <image class="indexOrderIcon" bindtap="placingControl" src="{{imgUrl+'/images/indexOrderIcon.png'}}"></image>
</view> </view>
<scroll-view class="placingOrderGroup" wx:if="{{selectNow==4 && couponList.length}}" scroll-y bindscrolltolower="scrolltolower3"> <scroll-view class="placingOrderGroup" wx:if="{{selectNow==4 && couponList.length}}" scroll-y bindscrolltolower="scrolltolower3">
</view> </view>
<image class="orderCard" data-index="{{index}}" bindtap="vipDetailControl" src="{{imgUrl+'/newImages3/48.png'}}"></image> <image class="orderCard" data-index="{{index}}" bindtap="vipDetailControl" src="{{imgUrl+'/newImages3/48.png'}}"></image>
</view> </view>
<view class="placingOrder" wx:if="{{item.couponId=='179478'}}">
<view class="placingOrder" wx:if="{{item.couponId=='179478' || item.couponId=='190895'}}">
<view style="display:flex;align-items:center;"> <view style="display:flex;align-items:center;">
<image class="orderHead" src="{{imgUrl+'/newImages6/31.png'}}" mode="aspectFit"></image> <image class="orderHead" src="{{imgUrl+'/newImages6/31.png'}}" mode="aspectFit"></image>
<view style="margin-left:15rpx;margin-right:101rpx;"> <view style="margin-left:15rpx;margin-right:101rpx;">
</view> </view>
<image class="orderCard" data-index="{{index}}" bindtap="vipDetailControl" src="{{imgUrl+'/newImages3/48.png'}}"></image> <image class="orderCard" data-index="{{index}}" bindtap="vipDetailControl" src="{{imgUrl+'/newImages3/48.png'}}"></image>
</view> </view>


<view class="placingOrder" wx:if="{{false}}">
<view style="display:flex;align-items:center;">
<image class="orderHead" src="{{imgUrl+'/newImages9/prizes/2.png'}}" mode="aspectFit"></image>
<view style="margin-left:15rpx;margin-right:101rpx;">
<view class="cardTitle">2寸行车记录仪</view>
<view class="cardCtime">{{item.cdate}}</view>
</view>
</view>
<image class="orderCard" data-index="{{index}}" bindtap="vipDetailControl" src="{{imgUrl+'/newImages3/48.png'}}"></image>
</view>


</view> </view>
</view> </view>
</scroll-view> </scroll-view>
<view class="lineSty"></view> <view class="lineSty"></view>
<image class="closeXieyi" bindtap="starMoveHide" src="{{imgUrl+'/images/closeXieyi.png'}}"></image> <image class="closeXieyi" bindtap="starMoveHide" src="{{imgUrl+'/images/closeXieyi.png'}}"></image>
<view style="position:relative;"> <view style="position:relative;">
<image style="width:750rpx;height:2005rpx;" src="{{imgUrl+'/newImages6/46.png?s=004'}}"></image>
<image style="width:750rpx;height:2005rpx;" src="{{imgUrl+'/newImages9/22.png'}}"></image>
<image class="newImages3-45" bindtap="starMoveHide" src="{{imgUrl+'/newImages3/45.png'}}"></image> <image class="newImages3-45" bindtap="starMoveHide" src="{{imgUrl+'/newImages3/45.png'}}"></image>
</view> </view>
<view class="cardCode" wx:if="{{couponListCode}}">{{couponListCode}}<view bindtap="cardCodeCopy" class="cardCodeCopy">复制</view></view> <view class="cardCode" wx:if="{{couponListCode}}">{{couponListCode}}<view bindtap="cardCodeCopy" class="cardCodeCopy">复制</view></view>

+ 1
- 1
496_dongfengqichen/pages/placingOrder/placingOrder.wxml Ver arquivo

<image class="closeTip" bindtap="tipShowControl" src="{{imgUrl+'/newImages4/15.png'}}"></image> <image class="closeTip" bindtap="tipShowControl" src="{{imgUrl+'/newImages4/15.png'}}"></image>
<image class="tipGroupBg" src="{{imgUrl+'/newImages4/12.png'}}"></image> <image class="tipGroupBg" src="{{imgUrl+'/newImages4/12.png'}}"></image>
<view class="tipGroupContent"> <view class="tipGroupContent">
<image class="tipGroupContentImg" src="{{imgUrl+'/newImages6/48.png?s=006'}}"></image>
<image class="tipGroupContentImg" src="{{imgUrl+'/newImages9/23.png'}}"></image>
<image class="tipGroupContentBtn" bindtap="tipShowControl2" src="{{imgUrl+'/newImages4/14.png'}}"></image> <image class="tipGroupContentBtn" bindtap="tipShowControl2" src="{{imgUrl+'/newImages4/14.png'}}"></image>
</view> </view>
</view> </view>

+ 1
- 1
496_dongfengqichen/project.config.json Ver arquivo

"ignore": [] "ignore": []
}, },
"setting": { "setting": {
"urlCheck": true,
"urlCheck": false,
"es6": true, "es6": true,
"postcss": true, "postcss": true,
"minified": true, "minified": true,

+ 192
- 0
496_dongfengqichen/utils/md5.js Ver arquivo

var hexcase = 0;
var b64pad = "";
var chrsz = 8;
function hex_md5(s){ return binl2hex(core_md5(str2binl(s), s.length * chrsz));}
function b64_md5(s){ return binl2b64(core_md5(str2binl(s), s.length * chrsz));}
function hex_hmac_md5(key, data) { return binl2hex(core_hmac_md5(key, data)); }
function b64_hmac_md5(key, data) { return binl2b64(core_hmac_md5(key, data)); }
function calcMD5(s){ return binl2hex(core_md5(str2binl(s), s.length * chrsz));}

function md5_vm_test()
{
return hex_md5("abc") == "900150983cd24fb0d6963f7d28e17f72";
}

function core_md5(x, len)
{

x[len >> 5] |= 0x80 << ((len) % 32);
x[(((len + 64) >>> 9) << 4) + 14] = len;
var a = 1732584193;
var b = -271733879;
var c = -1732584194;
var d = 271733878;
for(var i = 0; i < x.length; i += 16)
{
var olda = a;
var oldb = b;
var oldc = c;
var oldd = d;

a = md5_ff(a, b, c, d, x[i+ 0], 7 , -680876936);
d = md5_ff(d, a, b, c, x[i+ 1], 12, -389564586);
c = md5_ff(c, d, a, b, x[i+ 2], 17, 606105819);
b = md5_ff(b, c, d, a, x[i+ 3], 22, -1044525330);
a = md5_ff(a, b, c, d, x[i+ 4], 7 , -176418897);
d = md5_ff(d, a, b, c, x[i+ 5], 12, 1200080426);
c = md5_ff(c, d, a, b, x[i+ 6], 17, -1473231341);
b = md5_ff(b, c, d, a, x[i+ 7], 22, -45705983);
a = md5_ff(a, b, c, d, x[i+ 8], 7 , 1770035416);
d = md5_ff(d, a, b, c, x[i+ 9], 12, -1958414417);
c = md5_ff(c, d, a, b, x[i+10], 17, -42063);
b = md5_ff(b, c, d, a, x[i+11], 22, -1990404162);
a = md5_ff(a, b, c, d, x[i+12], 7 , 1804603682);
d = md5_ff(d, a, b, c, x[i+13], 12, -40341101);
c = md5_ff(c, d, a, b, x[i+14], 17, -1502002290);
b = md5_ff(b, c, d, a, x[i+15], 22, 1236535329);
a = md5_gg(a, b, c, d, x[i+ 1], 5 , -165796510);
d = md5_gg(d, a, b, c, x[i+ 6], 9 , -1069501632);
c = md5_gg(c, d, a, b, x[i+11], 14, 643717713);
b = md5_gg(b, c, d, a, x[i+ 0], 20, -373897302);
a = md5_gg(a, b, c, d, x[i+ 5], 5 , -701558691);
d = md5_gg(d, a, b, c, x[i+10], 9 , 38016083);
c = md5_gg(c, d, a, b, x[i+15], 14, -660478335);
b = md5_gg(b, c, d, a, x[i+ 4], 20, -405537848);
a = md5_gg(a, b, c, d, x[i+ 9], 5 , 568446438);
d = md5_gg(d, a, b, c, x[i+14], 9 , -1019803690);
c = md5_gg(c, d, a, b, x[i+ 3], 14, -187363961);
b = md5_gg(b, c, d, a, x[i+ 8], 20, 1163531501);
a = md5_gg(a, b, c, d, x[i+13], 5 , -1444681467);
d = md5_gg(d, a, b, c, x[i+ 2], 9 , -51403784);
c = md5_gg(c, d, a, b, x[i+ 7], 14, 1735328473);
b = md5_gg(b, c, d, a, x[i+12], 20, -1926607734);
a = md5_hh(a, b, c, d, x[i+ 5], 4 , -378558);
d = md5_hh(d, a, b, c, x[i+ 8], 11, -2022574463);
c = md5_hh(c, d, a, b, x[i+11], 16, 1839030562);
b = md5_hh(b, c, d, a, x[i+14], 23, -35309556);
a = md5_hh(a, b, c, d, x[i+ 1], 4 , -1530992060);
d = md5_hh(d, a, b, c, x[i+ 4], 11, 1272893353);
c = md5_hh(c, d, a, b, x[i+ 7], 16, -155497632);
b = md5_hh(b, c, d, a, x[i+10], 23, -1094730640);
a = md5_hh(a, b, c, d, x[i+13], 4 , 681279174);
d = md5_hh(d, a, b, c, x[i+ 0], 11, -358537222);
c = md5_hh(c, d, a, b, x[i+ 3], 16, -722521979);
b = md5_hh(b, c, d, a, x[i+ 6], 23, 76029189);
a = md5_hh(a, b, c, d, x[i+ 9], 4 , -640364487);
d = md5_hh(d, a, b, c, x[i+12], 11, -421815835);
c = md5_hh(c, d, a, b, x[i+15], 16, 530742520);
b = md5_hh(b, c, d, a, x[i+ 2], 23, -995338651);
a = md5_ii(a, b, c, d, x[i+ 0], 6 , -198630844);
d = md5_ii(d, a, b, c, x[i+ 7], 10, 1126891415);
c = md5_ii(c, d, a, b, x[i+14], 15, -1416354905);
b = md5_ii(b, c, d, a, x[i+ 5], 21, -57434055);
a = md5_ii(a, b, c, d, x[i+12], 6 , 1700485571);
d = md5_ii(d, a, b, c, x[i+ 3], 10, -1894986606);
c = md5_ii(c, d, a, b, x[i+10], 15, -1051523);
b = md5_ii(b, c, d, a, x[i+ 1], 21, -2054922799);
a = md5_ii(a, b, c, d, x[i+ 8], 6 , 1873313359);
d = md5_ii(d, a, b, c, x[i+15], 10, -30611744);
c = md5_ii(c, d, a, b, x[i+ 6], 15, -1560198380);
b = md5_ii(b, c, d, a, x[i+13], 21, 1309151649);
a = md5_ii(a, b, c, d, x[i+ 4], 6 , -145523070);
d = md5_ii(d, a, b, c, x[i+11], 10, -1120210379);
c = md5_ii(c, d, a, b, x[i+ 2], 15, 718787259);
b = md5_ii(b, c, d, a, x[i+ 9], 21, -343485551);

a = safe_add(a, olda);
b = safe_add(b, oldb);
c = safe_add(c, oldc);
d = safe_add(d, oldd);
}
return Array(a, b, c, d);
}

function md5_cmn(q, a, b, x, s, t)
{
return safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s),b);
}
function md5_ff(a, b, c, d, x, s, t)
{
return md5_cmn((b & c) | ((~b) & d), a, b, x, s, t);
}
function md5_gg(a, b, c, d, x, s, t)
{
return md5_cmn((b & d) | (c & (~d)), a, b, x, s, t);
}
function md5_hh(a, b, c, d, x, s, t)
{
return md5_cmn(b ^ c ^ d, a, b, x, s, t);
}
function md5_ii(a, b, c, d, x, s, t)
{
return md5_cmn(c ^ (b | (~d)), a, b, x, s, t);
}

function core_hmac_md5(key, data)
{
var bkey = str2binl(key);
if(bkey.length > 16) bkey = core_md5(bkey, key.length * chrsz);

var ipad = Array(16), opad = Array(16);
for(var i = 0; i < 16; i++)
{
ipad[i] = bkey[i] ^ 0x36363636;
opad[i] = bkey[i] ^ 0x5C5C5C5C;
}

var hash = core_md5(ipad.concat(str2binl(data)), 512 + data.length * chrsz);
return core_md5(opad.concat(hash), 512 + 128);
}

function safe_add(x, y)
{
var lsw = (x & 0xFFFF) + (y & 0xFFFF);
var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
return (msw << 16) | (lsw & 0xFFFF);
}

function bit_rol(num, cnt)
{
return (num << cnt) | (num >>> (32 - cnt));
}

function str2binl(str)
{
var bin = Array();
var mask = (1 << chrsz) - 1;
for(var i = 0; i < str.length * chrsz; i += chrsz)
bin[i>>5] |= (str.charCodeAt(i / chrsz) & mask) << (i%32);
return bin;
}

function binl2hex(binarray)
{
var hex_tab = hexcase ? "0123456789ABCDEF" : "0123456789abcdef";
var str = "";
for(var i = 0; i < binarray.length * 4; i++)
{
str += hex_tab.charAt((binarray[i>>2] >> ((i%4)*8+4)) & 0xF) +
hex_tab.charAt((binarray[i>>2] >> ((i%4)*8 )) & 0xF);
}
return str;
}

function binl2b64(binarray)
{
var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
var str = "";
for(var i = 0; i < binarray.length * 4; i += 3)
{
var triplet = (((binarray[i >> 2] >> 8 * ( i %4)) & 0xFF) << 16)
| (((binarray[i+1 >> 2] >> 8 * ((i+1)%4)) & 0xFF) << 8 )
| ((binarray[i+2 >> 2] >> 8 * ((i+2)%4)) & 0xFF);
for(var j = 0; j < 4; j++)
{
if(i * 8 + j * 6 > binarray.length * 32) str += b64pad;
else str += tab.charAt((triplet >> 6*(3-j)) & 0x3F);
}
}
return str;
}
module.exports = { hexMD5: hex_md5 };

Carregando…
Cancelar
Salvar