功能:同步小程序流程
This commit is contained in:
@@ -2,6 +2,10 @@ const { formatPrice, getProductTitle } = require('./format')
|
||||
const { resolveImageList } = require('./file')
|
||||
const { DEFAULT_PRODUCT_IMAGE } = require('./config')
|
||||
|
||||
/**
|
||||
* Purpose: getProductTags supports product.js by holding or executing the get product tags page or API role.
|
||||
* Usage: import, call, read, or update this function from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
function getProductTags(product) {
|
||||
if (Array.isArray(product && product.tagInfos)) {
|
||||
return product.tagInfos
|
||||
@@ -13,6 +17,10 @@ function getProductTags(product) {
|
||||
return []
|
||||
}
|
||||
|
||||
/**
|
||||
* Purpose: buildProductCard supports product.js by holding or executing the build product card page or API role.
|
||||
* Usage: import, call, read, or update this function from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
async function buildProductCard(product) {
|
||||
const images = await resolveImageList(product && product.imageFileIds, DEFAULT_PRODUCT_IMAGE)
|
||||
return {
|
||||
@@ -28,6 +36,10 @@ async function buildProductCard(product) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Purpose: buildProductCards supports product.js by holding or executing the build product cards page or API role.
|
||||
* Usage: import, call, read, or update this function from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
async function buildProductCards(products) {
|
||||
const list = Array.isArray(products) ? products : []
|
||||
return Promise.all(list.map(item => buildProductCard(item)))
|
||||
|
||||
Reference in New Issue
Block a user