Commit 7f081ec8 by 高淑倩

add: 外卖跳转

parent 7ff0b8d1
...@@ -55,13 +55,5 @@ Component({ ...@@ -55,13 +55,5 @@ Component({
}) })
} }
} }
// preview() {
// wx.previewImage({
// current: 'https://images.unsplash.com/photo-1551334787-21e6bd3ab135?w=640', // 当前显示图片的http链接
// urls: ['https://images.unsplash.com/photo-1551334787-21e6bd3ab135?w=640',
// 'https://images.unsplash.com/photo-1551214012-84f95e060dee?w=640',
// 'https://images.unsplash.com/photo-1551446591-142875a901a1?w=640'] // 需要预览的图片http链接列表
// })
// }
} }
}) })
// component/picNav/picNav.js
var app = getApp()
const wxService = require('../../utils/wxService')
const utils = require('../../utils/util')
const envInfo = require('../../config/index').envInfo
Component({
/**
* 组件的属性列表
*/
properties: {
picNav: {
type: Array,
value: [],
},
},
attached () {},
/**
* 组件的初始数据
*/
data: {
},
/**
* 组件的方法列表
*/
methods: {
preview(e) {
const {url,currentUrl} = e.currentTarget.dataset
wx.previewImage({
current: `https://images.unsplash.com/${currentUrl}`, // 当前显示图片的http链接
urls: [`http://testimg3.bigaka.com/${url}`] // 需要预览的图片http链接列表
})
}
}
})
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
<!--component/picNav/picNav.wxml-->
<view class="pic-nav">
<block wx:for="{{picNav}}" wx:key="{{index}}" wx:for-item="item" class="pic-content">
<view class="pic-item"><image class="pic-img" src="http://testimg3.bigaka.com{{item.imageUrl}}" data-current-url="{{item.imageUrl}}" data-url="{{item.link.url}}" bindtap='preview' mode="scaleToFill"/></view>
</block>
</view>
/* component/picNav/picNav.wxss */
.pic-nav {
display: flex;
padding: 10rpx 20rpx;
}
.pic-item {
flex: 1;
height: 200rpx;
border-radius:10rpx;
}
.pic-img {
height: 100%;
width: 100%;
}
\ No newline at end of file
const PROJECT_ENV = 'pre' // 生产 prod, 测试 dev, 预生产 pre const PROJECT_ENV = 'dev' // 生产 prod, 测试 dev, 预生产 pre
const needMock = '' // const needMock = '' //
// appid_dev_wx wxc3b64b09b1d3dfc2 // appid_dev_wx wxc3b64b09b1d3dfc2
......
...@@ -44,7 +44,7 @@ wxService.page({ ...@@ -44,7 +44,7 @@ wxService.page({
wx.showLoading({ wx.showLoading({
title: '加载中' title: '加载中'
}) })
wxService.get(`/sale/order/findByOrderNo?orderNo=${orderNo}&brandId=2005`).then(res => { wxService.get(`/sale/order/findByOrderNo?orderNo=${orderNo}&brandId=1002`).then(res => {
const {result,data} = res.data const {result,data} = res.data
if(result == 0){ if(result == 0){
wx.hideLoading() wx.hideLoading()
......
...@@ -3,20 +3,42 @@ const app = getApp() ...@@ -3,20 +3,42 @@ const app = getApp()
const wxService = require('../../utils/wxService') const wxService = require('../../utils/wxService')
const utils = require('../../utils/util') const utils = require('../../utils/util')
const envInfo = require('../../config/index').envInfo const envInfo = require('../../config/index').envInfo
let renderPage = null // 渲染页面数据对象(安全渲染)
let handlerDataOnPage = null
const logger = utils.logger
wxService.page({ wxService.page({
/** /**
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
pages:[],
render: null, // 渲染页面数据对象(安全渲染)
renderPageOver: false, // 渲染页面结束
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function (options) {
this.setData(
{
pages: [],
groupLoadState: 'complete', // 活动分组加载标志
homeApiLoading: true,
render: null, // 渲染页面数据对象(安全渲染)
isLastPage: false, // 页面段落加载完成
renderPageOver: false // 渲染页面结束
},
() => {
// this.loadMore()
}
)
handlerDataOnPage = new utils.HandlerDataOnPage()
renderPage = require('../../utils/renderPage').getRenderPage()
handlerDataOnPage.init(this, 'pages')
this.getDeliveryServiceList()
}, },
/** /**
...@@ -25,13 +47,60 @@ wxService.page({ ...@@ -25,13 +47,60 @@ wxService.page({
onReady: function () { onReady: function () {
}, },
getDeliveryServiceList() {
this.setData({
products: []
})
wx.showLoading({
title: '加载中'
})
wxService.post(`/merchant/modelPage/getDetailById?pageId=4`).then(res => {
const {result,data} = res.data
if(result == 0){
// 动态设置title
wx.setNavigationBarTitle({
title: data.page.title
})
// 段落
const products = data.paragraphs
const filterResult = products.map((res,index)=>{
return {
...res,index
}
}).filter(item=> {
// wx.hideLoading()
})
const render = renderPage.initPaging(filterResult).initRenderData(products)
this.data.render = render
const renderData = render.next()
this.data.renderPageOver = renderData.done
this.renderPageFunc({ products: renderData.value })
}
}).finally(() => {
wx.hideLoading();
})
},
/** /**
* 生命周期函数--监听页面显示 * 渲染数据(合并之前的数据)
* @param products 数组数据
* @param isLastPage
* @param now
*/ */
onShow: function () { renderPageFunc ({ products }) {
let productData = handlerDataOnPage.handlerArray(products)
logger.log('productData.keysNum', productData.keysNum(), productData)
this.setData({
...productData
},()=>{
wx.hideLoading()
})
}, },
/**
* 生命周期函数--监听页面显示
*/
onShow () {},
/** /**
* 生命周期函数--监听页面隐藏 * 生命周期函数--监听页面隐藏
......
{ {
"navigationBarTitleText": "外卖服务", "navigationBarTitleText": "外卖服务",
"usingComponents": {} "usingComponents": {
"pic-nav-serve": "/component/picNavServe/picNavServe"
}
} }
\ No newline at end of file
<!--pages/userCenter.wxml--> <!--pages/userCenter.wxml-->
<text>pages/userCenter.wxml</text> <block wx:for="{{pages}}" wx:key="{{index}}" wx:for-item="pItem">
<pic-nav-serve pic-nav="{{pItem.navigation.images}}" />
</block>
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
}, },
"compileType": "miniprogram", "compileType": "miniprogram",
"libVersion": "2.6.6", "libVersion": "2.6.6",
"appid": "wx358b56af62edbde1", "appid": "wxc3b64b09b1d3dfc2",
"tempappid_wx": "wxc3b64b09b1d3dfc2", "tempappid_wx": "wxc3b64b09b1d3dfc2",
"tempappid_711": "wx358b56af62edbde1", "tempappid_711": "wx358b56af62edbde1",
"projectname": "7-Eleven", "projectname": "7-Eleven",
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
"list": [] "list": []
}, },
"miniprogram": { "miniprogram": {
"current": 6, "current": 13,
"list": [ "list": [
{ {
"id": -1, "id": -1,
...@@ -118,6 +118,12 @@ ...@@ -118,6 +118,12 @@
"name": "空白页", "name": "空白页",
"pathName": "pages/index/index", "pathName": "pages/index/index",
"query": "" "query": ""
},
{
"id": -1,
"name": "外卖",
"pathName": "pages/deliveryService/deliveryService",
"query": ""
} }
] ]
} }
......
...@@ -235,8 +235,8 @@ function getUserInfoByBtn(userInfo) { ...@@ -235,8 +235,8 @@ function getUserInfoByBtn(userInfo) {
return wxService.post(`/member/minaLogin`, { return wxService.post(`/member/minaLogin`, {
code: res[1].code, code: res[1].code,
wechatInfo: res[0], wechatInfo: res[0],
brandId: 2005, // brandId: 2005,
// brandId: 1001, brandId: 1001,
}) })
}, (err) => { }, (err) => {
return Promise.reject(err) return Promise.reject(err)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment