diff --git a/app.js b/app.js
index e8899e2..3228d7e 100644
--- a/app.js
+++ b/app.js
@@ -99,6 +99,7 @@ App({
WEIXIN:"微信支付",
JIANSHEYINHANG:"建行支付",
ZHIFUBAO:"支付宝支付"
- }
+ },
+ kjId:null
}
})
\ No newline at end of file
diff --git a/app.json b/app.json
index 96d8e65..6be562c 100644
--- a/app.json
+++ b/app.json
@@ -87,6 +87,8 @@
"pages/list/minitrip/index",
"pages/list/oneday/index",
"pages/pbService/index",
+ "pages/pbService/museum/index",
+ "pages/pbService/museum/info/index",
"pages/pbService/PRpark/index",
"pages/pbService/sceneComfort/index",
"pages/pbService/gym/index",
@@ -113,6 +115,7 @@
"pages/ask/index",
"pages/ask/info/index",
"pages/ask/my/index",
+ "pages/activity/graduate/index",
"pages/activity/year2020/index",
"pages/activity/suyear/index",
"pages/activity/spring2021/index",
diff --git a/pages/activity/graduate/index.js b/pages/activity/graduate/index.js
new file mode 100644
index 0000000..9d1618a
--- /dev/null
+++ b/pages/activity/graduate/index.js
@@ -0,0 +1,114 @@
+// pages/activity/graduate/index.js
+import commonApi from "../../../utils/https/common"
+import util from "../../../utils/util"
+Page({
+
+ /**
+ * 页面的初始数据
+ */
+ data: {
+ list:[[],[],[],[]]
+ },
+
+ /**
+ * 生命周期函数--监听页面加载
+ */
+ onLoad: function (options) {
+ let ajaxes = [],list = [];
+ wx.showLoading({
+ title: '加载中',
+ });
+ ['62','63','64'].map(item=>{
+ ajaxes.push(commonApi._post("product/get_product_by_tag",{
+ tag_id: item,
+ offset: 0,
+ limit: 100
+ }))
+ });
+ ajaxes.push(commonApi._post("scene/get_scene_by_tag",{
+ tag_id: 30,
+ offset: 0,
+ limit: 100
+ }))
+ Promise.all(ajaxes).then(res=>{
+ res.map(item=>{
+ item.data.list.map(i=>{
+ i.display_tags = i.display_tags?i.display_tags.split(","):[];
+ i.display_tags = i.display_tags.slice(0,2);
+ })
+ list.push(item.data.list);
+ })
+ this.setData({
+ list:list
+ })
+ wx.hideLoading({})
+ })
+ },
+ gotoDetail:function(e){
+ let item = e.currentTarget.dataset.item;
+ util.gotoDetail(item)
+ },
+ scrollToBox:function(e){
+ let index = e.currentTarget.dataset.index;
+ const query=wx.createSelectorQuery(); //创建节点查询器
+ query.select("#box"+index).boundingClientRect() //选择toViewid获取位置信息
+ query.selectViewport().scrollOffset() //获取页面查询位置的
+ query.exec(function(res) {
+ console.log(res)
+ let scrollTop = res[0].top + res[1].scrollTop ;
+ wx.pageScrollTo({
+ scrollTop: scrollTop - 60,
+ duration: 200
+ })
+ })
+ },
+
+ /**
+ * 生命周期函数--监听页面初次渲染完成
+ */
+ onReady: function () {
+
+ },
+
+ /**
+ * 生命周期函数--监听页面显示
+ */
+ onShow: function () {
+
+ },
+
+ /**
+ * 生命周期函数--监听页面隐藏
+ */
+ onHide: function () {
+
+ },
+
+ /**
+ * 生命周期函数--监听页面卸载
+ */
+ onUnload: function () {
+
+ },
+
+ /**
+ * 页面相关事件处理函数--监听用户下拉动作
+ */
+ onPullDownRefresh: function () {
+
+ },
+
+ /**
+ * 页面上拉触底事件的处理函数
+ */
+ onReachBottom: function () {
+
+ },
+
+ /**
+ * 用户点击右上角分享
+ */
+ onShareAppMessage: function () {
+
+ }
+})
\ No newline at end of file
diff --git a/pages/activity/graduate/index.json b/pages/activity/graduate/index.json
new file mode 100644
index 0000000..8835af0
--- /dev/null
+++ b/pages/activity/graduate/index.json
@@ -0,0 +1,3 @@
+{
+ "usingComponents": {}
+}
\ No newline at end of file
diff --git a/pages/activity/graduate/index.wxml b/pages/activity/graduate/index.wxml
new file mode 100644
index 0000000..25806d5
--- /dev/null
+++ b/pages/activity/graduate/index.wxml
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
+
+
+ {{item.title}}
+
+ {{item}}
+
+
+ ¥{{item.price/100}}
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pages/activity/graduate/index.wxss b/pages/activity/graduate/index.wxss
new file mode 100644
index 0000000..b88e397
--- /dev/null
+++ b/pages/activity/graduate/index.wxss
@@ -0,0 +1,132 @@
+/* pages/activity/graduate/index.wxss */
+.mainimg {
+ display: block;
+ width: 100%;
+}
+page {
+ background: url(https://sz-qd.oss-cn-hangzhou.aliyuncs.com/xcxImages/activity/graduate/bg.png);
+ background-size: 100%;
+ background-repeat: repeat-y;
+}
+.top-menus {
+ display: flex;
+ align-items: center;
+ position: absolute;
+ justify-content: space-between;
+ left: 34rpx;
+ right: 34rpx;
+ top: 546rpx;
+ z-index: 1;
+ color: #fff;
+ line-height: 51rpx;
+}
+.top-menu {
+ width: 149rpx;
+ border-radius: 19rpx;
+ font-size: 26rpx;
+ flex-shrink: 0;
+ letter-spacing: 3rpx;
+ background: #308506;
+ text-align: center;
+ font-weight: lighter;
+}
+.list {
+ position: relative;
+ margin: 10rpx 27rpx;
+ border: solid 1rpx #7c9112;
+ padding: 8rpx;
+ border-radius: 16rpx;
+ z-index: 1;
+ margin-bottom: 40rpx;
+}
+.list-box {
+ border-radius: 16rpx;
+ background-color: #f6f0e4;
+ border: solid 3rpx #7c9112;
+ padding: 56rpx 30rpx;
+ display: flex;
+ justify-content: space-between;
+ flex-wrap: wrap;
+}
+.item .mainimg {
+ width: 286rpx;
+ height: 253rpx;
+ border-radius: 16rpx;
+}
+.item {
+ border-radius: 16rpx;
+ padding: 7rpx;
+ width: 286rpx;
+ border: 1rpx dashed;
+ color: #7c9112;
+ margin-top: 27rpx;
+}
+.titleimg {
+ position: absolute;
+ display: block;
+ width: 326rpx;
+ height: 67rpx;
+ left: 50%;
+ margin-left: -163rpx;
+ top: -28rpx;
+}
+.item .title {
+ font-size: 25rpx;
+ line-height: 38rpx;
+ letter-spacing: -2rpx;
+ color: #469115;
+ margin: 5rpx 10rpx;
+}
+.product-tags {
+ margin: 0 10rpx;
+ display: flex;
+ align-items: center;
+ margin-bottom: 10rpx;
+ height: 20rpx;
+}
+.product-tag {
+ line-height: 20rpx;
+ background-color: #b1c346;
+ padding: 0 15rpx;
+ font-size: 12rpx;
+ color: #495800;
+ margin-right: 8rpx;
+}
+.product-tags:last-child {
+ margin-right: 0;
+}
+.product-bottom {
+ display: flex;
+ justify-content: space-between;
+ margin: 0 10rpx;
+ padding-bottom: 6rpx;
+ color: #6ea21b;
+ font-size: 14rpx;
+ align-items: flex-end;
+}
+.product-bottom image {
+ width: 120rpx;
+ display: block;
+ flex-shrink: 0;
+}
+.product-bottom text {
+ font-size: 31rpx;
+ font-weight: 500;
+ line-height: 31rpx;
+ margin-left: 10rpx;
+}
+.bottombg {
+ position: absolute;
+ bottom: 0;
+ left: 0;
+ width: 100%;
+ display: block;
+ z-index: 0;
+}
+.bottomtext {
+ position: absolute;
+ right: 0;
+ width: 439rpx;
+ bottom: 0;
+ z-index: 2;
+}
\ No newline at end of file
diff --git a/pages/kj/his/index.wxml b/pages/kj/his/index.wxml
index 827f5d6..5d3d3e4 100644
--- a/pages/kj/his/index.wxml
+++ b/pages/kj/his/index.wxml
@@ -1,7 +1,7 @@
-
+
{{item.help_user_name}}
{{item.created_time}}
diff --git a/pages/kj/index.js b/pages/kj/index.js
index 141a407..5999f53 100644
--- a/pages/kj/index.js
+++ b/pages/kj/index.js
@@ -1,5 +1,6 @@
// pages/user/pdd/index.js
import productApi from "../../utils/https/common"
+import util from "../../utils/util"
let timer = null,app = getApp();
Page({
@@ -25,7 +26,7 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
- // this.getMine();
+ this.getMine();
productApi.user_post("activity.haggle/get_act_list",{limit:100,page:1}).then(res=>{
this.setData({
menuList:res.data.data,
@@ -60,73 +61,54 @@ Page({
this.getList()
},
gotoDetail:function(e){
- let data = e.currentTarget.dataset;
+ let data = e.currentTarget.dataset,that = this;
if(data.index || data.index==0){
let item = this.data.list[data.index];
console.log(item)
// 已砍成已下单
- if(item.myOriginateFlag=='over' && item.isBuyed==1){
+ if(item.buy_status=='end'){
wx.showModal({
title:"提示",
content:"单个商品单账户只可参与一次,是否原价购买",
confirmColor:"#e14135",
success:function(res){
if(res.confirm){
- wx.navigateTo({
- url: '/pages/info/'+(item.frontShowModel=='line'?'productInfo':'skuProductInfo')+'/index?id='+item.productId
- })
+ that.gotoProduct(item.goods_id)
}
}
})
return;
}
// 已砍成未下单
- if(item.myOriginateFlag=='over' && item.isBuyed!=1){
- productApi._get('productfront/getProductInfo',{
- productId:item.productId
- }).then(res=>{
- if(!res.data){
- wx.showToast({
- title:"该产品不存在或已下架",
- icon:'none'
+ if(item.buy_status=='over'){
+ app.globalData.kjId = item.buy_id;
+ // todo
+ util.goKjOrder(item).then(product=>{
+ app.globalData.couponInfo = null;
+ if(item.type=='post'){
+ app.globalData.postProduct = product;
+ wx.navigateTo({
+ url: '/pages/order/postOrder/index',
})
- return;
}
- let skuIndex = res.data.skuInfo.findIndex(skuItem=>skuItem.id==item.skuId);
- if(skuIndex==-1) {
- wx.showToast({
- title:"该产品规格不存在",
- icon:'none'
+ else if(item.type=='ticket' || item.type=='scene'){
+ app.globalData.product = product;
+ wx.navigateTo({
+ url: '/pages/order/scene/index',
})
- return;
}
- let sku = res.data.skuInfo[skuIndex];
- app.globalData.shoppingCart=[{
- baseInfo:res.data.baseInfo,
- modelInfo:sku.modelInfo,
- skuInfo:sku,
- productNum:1
- }]
- app.globalData.discounts = 0;
- // todo
- app.globalData.kjOrderId = item.originateId || null
- wx.navigateTo({
- url: '/pages/order/index',
- })
})
return;
}
// 已售罄
- if(item.stock<=0){
+ if(item.act_stock<=0){
wx.showModal({
title:"提示",
content:"此商品已售罄,是否原价购买",
confirmColor:"#e14135",
success:function(res){
if(res.confirm){
- wx.navigateTo({
- url: '/pages/info/'+(item.frontShowModel=='line'?'productInfo':'skuProductInfo')+'/index?id='+item.productId
- })
+ that.gotoProduct(item.goods_id)
}
}
})
@@ -138,13 +120,24 @@ Page({
url:"info/index?id="+data.id+"&sid="+data.sid+"&aid="+data.aid
})
},
+ gotoProduct:function(id){
+ productApi._post("product/get_product_detail",{
+ id:id
+ }).then(res=>{
+ util.gotoDetail(res.data)
+ })
+ },
getMine:function(){
- productApi.user_post("kj/getMyKjIngProductsNeedAuth",{}).then(res=>{
+ productApi.user_post("order/my_haggle_list?status=1&limit=100&page=1",{
+ }).then(res=>{
this.setData({
- mineList:this.data.showMoreFlag?res.data:res.data.slice(0,2),
- mineAllList:res.data
+ mineList:this.data.showMoreFlag?res.data.data:res.data.data.slice(0,2),
+ mineAllList:res.data.data
})
this.setTime();
+ if(timer){
+ clearInterval(timer);
+ }
timer = setInterval(()=>{
this.setTime()
},1000)
@@ -213,7 +206,7 @@ Page({
setTime:function(){
let mineList = this.data.mineList,now = new Date().getTime();
mineList.map(item=>{
- let overTime = new Date(item.overTime.replace(/-/g,'/')).getTime();
+ let overTime = new Date(item.over_time.replace(/-/g,'/')).getTime();
if(overTime<=now){
item.isOver=true;
}
diff --git a/pages/kj/index.wxml b/pages/kj/index.wxml
index dad3a9c..0d108be 100644
--- a/pages/kj/index.wxml
+++ b/pages/kj/index.wxml
@@ -6,13 +6,13 @@
我参与的活动
-
+
{{item.title+item.sku_name}}
- ¥{{item.kjMoney/100}}
+ ¥{{item.kj_money/100}}
已结束
@@ -70,7 +70,7 @@
{{item.showMoreFlag?'点击收起':'点击查看更多'}}
暂无活动
-
+
我的
砍价
\ No newline at end of file
diff --git a/pages/kj/info/index.js b/pages/kj/info/index.js
index e17d740..3eaa10a 100644
--- a/pages/kj/info/index.js
+++ b/pages/kj/info/index.js
@@ -1,5 +1,6 @@
// pages/info/pddInfo/index.js
import productApi from "../../../utils/https/common";
+import util from "../../../utils/util"
let app = getApp();
let timer = null;
Page({
@@ -12,7 +13,7 @@ Page({
showRuleFlag:false,
kjId:null,
isKj:false,//是否是被邀请进来砍价的 本人去除
- isFollow:false,//是否已经关注公众号
+ isFollow:true,//是否已经关注公众号
showShareFlag:false,//是否显示公众号的二维码
userInfo:null,
helpList:[]
@@ -125,6 +126,13 @@ Page({
})
},
+ gotoProduct:function(){
+ productApi._post('product/get_product_detail',{
+ id:this.data.info.detail.goods_id
+ }).then(res=>{
+ util.gotoDetail(res.data);
+ })
+ },
// 如果已经发起活动的话需要倒计时
setTime(){
let info = this.data.info;
@@ -196,11 +204,6 @@ Page({
this.setTime()
},1000)
}
- productApi.user_post("wx/get_user_keep",{}).then(res=>{
- this.setData({
- isFollow:res.data.subscribe==1
- })
- })
},
/**
@@ -212,7 +215,7 @@ Page({
},
// 详情和下单的第一步
gotoDetail:function(e){
- let info = this.data.info.baseInfo || null,type=e.currentTarget.dataset.type;
+ let info = this.data.info.detail || null,type=e?e.currentTarget.dataset.type:null;
if(!info) return;
if(type=='fail'){
wx.showModal({
@@ -221,13 +224,13 @@ Page({
confirmColor:"#E14135",
success:function(res){
if(res.confirm){
- this.pushOrderData()
+ this.gotoProduct()
}
}
})
}
else {
- this.pushOrderData()
+ this.gotoProduct()
}
},
// 真实的获取产品信息去下单
diff --git a/pages/kj/info/index.wxml b/pages/kj/info/index.wxml
index 5680549..473a902 100644
--- a/pages/kj/info/index.wxml
+++ b/pages/kj/info/index.wxml
@@ -2,12 +2,12 @@
-
- 已结束
+
+ 已结束
活动规则
-
+
{{info.h}}
:
{{info.m}}
@@ -16,7 +16,11 @@
后结束
活动规则
-
+
+
+ {{userInfo.nickname}}
+ 活动规则
+
砍至0元可进行购买
@@ -27,7 +31,7 @@
¥{{info.detail.kj_money/100}}
- 查看详情 >
+ 查看详情 >
数量:1
diff --git a/pages/kj/mine/index.js b/pages/kj/mine/index.js
index 06eea71..b169495 100644
--- a/pages/kj/mine/index.js
+++ b/pages/kj/mine/index.js
@@ -1,20 +1,129 @@
-// pages/kj/mine/index.js
+// pages/user/pdd/index.js
+import productApi from "../../../utils/https/common";
+import util from "../../../utils/util"
+let timer = null,app = getApp();
Page({
/**
* 页面的初始数据
*/
data: {
-
+ type:1,
+ list:[],
+ page:1,
+ total:1
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
-
+ this.getList()
+ },
+ changeType:function(e){
+ let type = e.currentTarget.dataset.type;
+ if(this.data.type==type) return;
+ this.setData({
+ type:type,
+ total:1,
+ page:1,
+ list:[]
+ })
+ this.getList();
+ },
+ gotoDetail:function(e){
+ let data = e.currentTarget.dataset.item;
+ if(this.data.type==2 && data.flag!='expired'){
+ if(data.flag=='end'){
+ this.goOrder(e);
+ }
+ else {
+ this.goProduct(e)
+ }
+ return;
+ }
+ wx.navigateTo({
+ url:"../info/index?id="+data.act_product_id+"&userid="+data.user_id
+ })
+ },
+ getList:function(){
+ if(this.data.list.length>=this.data.total) return;
+ productApi.user_post("order/my_haggle_list?limit=10&page="+this.data.page+"&status="+this.data.type,{}).then(res=>{
+ this.setData({
+ list:this.data.list.concat(res.data.data),
+ page:this.data.page+1,
+ total:res.data.total
+ })
+ if(this.data.type==1){
+ this.setTime();
+ if(timer){
+ clearInterval(timer);
+ }
+ timer = setInterval(()=>{
+ this.setTime()
+ },1000)
+ }
+ })
+ },
+ setTime:function(){
+ let list = this.data.list,now = new Date().getTime();
+ list.map(item=>{
+ let overTime = item.over_time;
+ overTime = new Date(overTime.replace(/-/g,'/')).getTime();
+ if(overTime<=now){
+ item.isOver=true;
+ }
+ else {
+ let t = (overTime - now)/1000;
+ let h = Math.floor(t/(60*60));
+ t = t - h * 60*60;
+ let m = Math.floor(t/60),s=Math.floor(t-m*60);
+ if(h<10) {
+ h="0"+h;
+ }
+ if(m<10) {
+ m="0"+m;
+ }
+ if(s<10) {
+ s="0"+s;
+ }
+ item.timeText=[h,m,s].join(" : ");
+ }
+ })
+ this.setData({
+ list:list
+ })
+ },
+ goProduct:function(e){
+ let item = e.currentTarget.dataset.item;
+ console.log(item);
+ productApi._post('product/get_product_detail',{
+ id:item.goods_id
+ }).then(res=>{
+ util.gotoDetail(res.data);
+ })
+ },
+ goOrder:function(e){
+ productApi.user_post("order/query",{
+ order_id:e.currentTarget.dataset.item.order_id,
+ }).then(res=>{
+ util.gotoOrder(res.data)
+ })
+ },
+ gotoPdd:function(){
+ let page = getCurrentPages();
+ if(page[page.length-2] && page[page.length-2].route && page[page.length-2].route.indexOf('pages/kj/index')!=-1){
+ // 如果是从专题页列表来的 那么直接返回
+ wx.navigateBack({
+ delta: -1,
+ })
+ }
+ else {
+ wx.navigateTo({
+ url: '/pages/kj/index',
+ })
+ }
},
-
/**
* 生命周期函数--监听页面初次渲染完成
*/
@@ -26,14 +135,22 @@ Page({
* 生命周期函数--监听页面显示
*/
onShow: function () {
-
+ if(this.data.list.length>0){
+ this.setTime();
+ timer = setInterval(()=>{
+ this.setTime()
+ },1000)
+ }
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
-
+ if(timer){
+ clearInterval(timer);
+ timer = null;
+ }
},
/**
@@ -54,7 +171,7 @@ Page({
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
-
+ this.getList()
},
/**
diff --git a/pages/kj/mine/index.json b/pages/kj/mine/index.json
index 8835af0..35cf02f 100644
--- a/pages/kj/mine/index.json
+++ b/pages/kj/mine/index.json
@@ -1,3 +1,5 @@
{
- "usingComponents": {}
+ "usingComponents": {
+ "title":"/pages/component/TitleHeader"
+ }
}
\ No newline at end of file
diff --git a/pages/kj/mine/index.wxml b/pages/kj/mine/index.wxml
index 288de7e..11cf770 100644
--- a/pages/kj/mine/index.wxml
+++ b/pages/kj/mine/index.wxml
@@ -1,2 +1,37 @@
-
-pages/kj/mine/index.wxml
+
+
+
+
+
+
+
+
+
+ {{item.title+item.sku_name}}
+ ¥{{item.kj_money/100}}
+
+
+ 已结束
+ {{item.timeText}}后结束
+ 继续砍价
+
+
+ 砍成日期:{{item.finish_time}}
+
+
+
+
+ 前往下单
+ 查看订单
+
+
+
+
+
+ 您暂时还未参加砍价活动
+ 您暂时还未砍价成功
+ 立即前往
+
\ No newline at end of file
diff --git a/pages/kj/mine/index.wxss b/pages/kj/mine/index.wxss
index fd2b7ff..20faf52 100644
--- a/pages/kj/mine/index.wxss
+++ b/pages/kj/mine/index.wxss
@@ -1 +1,116 @@
-/* pages/kj/mine/index.wxss */
\ No newline at end of file
+.top-menus {
+ position: fixed;
+ left: 0;
+ right: 0;
+ height: 80rpx;
+ background: white;
+ display: flex;
+ justify-content: space-around;
+ align-items: center;
+ font-size: 30rpx;
+ line-height: 80rpx;
+}
+page {
+ background: #F2F2F2;
+}
+.top-menu.active {
+ color: #E14135;
+ position: relative;
+ font-weight: 500;
+}
+.top-menu.active::after {
+ content: "1";
+ font-size: 0;
+ width: 40rpx;
+ height: 6rpx;
+ background: linear-gradient(270deg, #E14135, #FF9124);
+ display: block;
+ border-radius: 3rpx;
+ position: absolute;
+ left: 50%;
+ margin-left: -20rpx;
+ bottom: 10rpx;
+}
+.title-header {
+ background: #fff !important;
+}
+.item {
+ margin: 20rpx 30rpx;
+ background: white;
+ border-radius: 20rpx;
+ font-size: 26rpx;
+}
+.item-top {
+ display: flex;
+ padding: 30rpx;
+}
+.item-top image {
+ width: 160rpx;
+ height: 160rpx;
+ display: block;
+ flex-shrink: 0;
+}
+.item-info {
+ margin-left: 30rpx;
+ color: #333333;
+ display: flex;
+ flex-direction: column;
+ justify-content: space-between;
+ flex: 1;
+ height: 160rpx;
+ width: 440rpx;
+}
+.item-info-top {
+ font-size: 30rpx;
+}
+.item-title {
+ font-weight: 500;
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ margin-bottom: 6rpx;
+}
+.item-info-bottom {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+}
+.item-info-bottom text {
+ color: #E14135;
+}
+.info-btn {
+ width: 160rpx;
+ text-align: center;
+ line-height: 50rpx;
+ height: 50rpx;
+ background: linear-gradient(0deg, #E14135, #FF9124);
+ border-radius: 25rpx;
+ color: #fff;
+ margin-left: 20rpx;
+}
+.list {
+ padding-top: 80rpx;
+}
+.item-bottom {
+ display: flex;
+ padding: 20rpx 30rpx;
+ border-top: 1rpx solid #d8d8d8;
+ justify-content: flex-end;
+}
+.info-btn-new {
+ background: #fff;
+ border: 2rpx solid;
+ color: #F34922;
+ box-sizing: border-box;
+}
+.empty-btn {
+ width: 240rpx;
+ height: 80rpx;
+ background: linear-gradient(0deg, #E14135, #FF9124);
+ border-radius: 40rpx;
+ line-height: 80rpx;
+ text-align: center;
+ color: #fff;
+ margin-top: 100rpx;
+ font-size: 30rpx;
+}
\ No newline at end of file
diff --git a/pages/map/index.js b/pages/map/index.js
index 8fcb741..f2941ba 100644
--- a/pages/map/index.js
+++ b/pages/map/index.js
@@ -25,7 +25,8 @@ Page({
menuIndex:-1,
productList:[],
productPage:1,
- productTotal:1
+ productTotal:1,
+ timeList:{}
},
/**
@@ -149,6 +150,18 @@ Page({
tenscenic_id:info.info.id,
page_no:1,
page_num:10
+ }),
+ commonApi._post("multimedia/media_list",{
+ tenscenic_id:info.info.id,
+ type:0,
+ page:1,
+ limit:10
+ }),
+ commonApi._post("multimedia/media_list",{
+ tenscenic_id:info.info.id,
+ type:1,
+ page:1,
+ limit:10
})]
Promise.all(ajaxes).then(res=>{
let menus = [],menuIndex=-1;
@@ -172,6 +185,14 @@ Page({
if(menuIndex==-1) menuIndex = 4;
menus[4] = "攻略"
}
+ if(res[5].data.total>0){
+ if(menuIndex==-1) menuIndex = 4;
+ menus[5] = "讲解"
+ }
+ if(res[6].data.total>0){
+ if(menuIndex==-1) menuIndex = 4;
+ menus[6] = "视频"
+ }
this.setData({
menus:menus,
menuIndex:menuIndex
@@ -244,9 +265,27 @@ Page({
delete data.limit;
service="travels/getList";
break;
+ case "讲解":
+ service="multimedia/media_list";
+ data = {
+ tenscenic_id:data.tenscenic_id,
+ page:data.page_no,
+ limit:10,
+ type:0
+ }
+ break;
+ case "视频":
+ service="multimedia/media_list";
+ data = {
+ tenscenic_id:data.tenscenic_id,
+ page:data.page_no,
+ limit:10,
+ type:1
+ }
+ break;
}
commonApi._post(service,data).then(res=>{
- let list = res.data.list || res.data.rows;
+ let list = res.data.list || res.data.rows || res.data.data;
list.map(item=>{
item.display_tags = item.display_tags?item.display_tags.split(","):[];
item.display_tags = item.display_tags.slice(0,2);
@@ -260,15 +299,66 @@ Page({
}
})
this.setData({
- productTotal:res.data.productTotal,
+ productTotal:res.data.productTotal || res.data.total,
productPage:this.data.productPage+1,
productList:this.data.productList.concat(list)
})
+ if(menu=='讲解'){
+ // 获取音频长度
+ let timeList = this.data.timeList;
+ list.map(item=>{
+ this['audioCtx'+item.id] = wx.createInnerAudioContext("audio"+item.id);
+ this['audioCtx'+item.id].src = item.multimedia_url;
+ this['audioCtx'+item.id].onEnded(()=>{
+ let productList = this.data.productList;
+ let productIndex = productList.findIndex(i=>i.id==item.id);
+ productList[productIndex].play = false;
+ this.setData({
+ productList:productList
+ })
+ })
+ this['audioCtx'+item.id].onTimeUpdate((e)=>{
+ timeList['audio'+item.id].time = this.audioTimeInit(this['audioCtx'+item.id].currentTime);
+ timeList['audio'+item.id].width = this['audioCtx'+item.id].currentTime / this['audioCtx'+item.id].duration * 100;
+ this.setData({
+ timeList:timeList
+ })
+ })
+ this['audioCtx'+item.id].onCanplay(() => {
+ this['audioCtx'+item.id].duration //类似初始化-必须触发-不触发此函数延时也获取不到
+ setTimeout( ()=>{
+ //在这里就可以获取到大家梦寐以求的时长了
+ if(!timeList['audio'+item.id]){
+ timeList['audio'+item.id] = {};
+ }
+ timeList['audio'+item.id].all_time=this.audioTimeInit(this['audioCtx'+item.id].duration);//延时获取长度 单位:秒
+ this.setData({
+ timeList:timeList
+ })
+ }, 1000) //这里设置延时1秒获取
+ })
+ })
+ }
})
}
},
+ audioTimeInit:function(second=0){
+ second = Math.round(second);
+ let min = Math.floor(second/60);
+ min = min<10?('0'+min):min;
+ second = second%60;
+ second = second<10?('0'+second):second;
+ return min+':'+second;
+ },
gotoDetailNew:function(e){
+ if(this.data.menus[this.data.menuIndex]=='讲解') return;
let item = e.currentTarget.dataset.item;
+ if(this.data.menus[this.data.menuIndex]=='视频') {
+ wx.navigateTo({
+ url: '/pages/pbService/appreciate/info/index?info='+encodeURIComponent(JSON.stringify(item)),
+ })
+ return;
+ }
util.gotoDetail(item);
},
showImages:function(e){
@@ -361,6 +451,32 @@ Page({
this.setData(e.detail)
this.getList()
},
+ // 讲解播放
+ startAuido:function(e){
+ let index = e.currentTarget.dataset.index,productList = this.data.productList;
+ productList[index].play = productList[index].play?false:true;
+ let audioCtx = this['audioCtx'+productList[index].id];
+ if(productList[index].play){
+ productList.map((item,i)=>{
+ if(item.play==true && index!=i){
+ item.play = false;
+ this['audioCtx'+item.id].pause()
+ }
+ })
+ audioCtx.play()
+ commonApi._post("multimedia/viewsInc",{
+ id:productList[index].id
+ }).then(res=>{
+
+ })
+ }
+ else {
+ audioCtx.pause()
+ }
+ this.setData({
+ productList:productList
+ })
+ },
/**
* 生命周期函数--监听页面初次渲染完成
diff --git a/pages/map/index.wxml b/pages/map/index.wxml
index f4e7935..41eca0a 100644
--- a/pages/map/index.wxml
+++ b/pages/map/index.wxml
@@ -66,9 +66,38 @@
-
+