Skip to content

Commit

Permalink
feat: 优化用户提示
Browse files Browse the repository at this point in the history
  • Loading branch information
ryan committed Sep 26, 2024
1 parent 0c701c2 commit cc3f6b5
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 8 deletions.
2 changes: 1 addition & 1 deletion miniprogram/tcb-demo-mpToWxStore/miniprogram/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ App({
console.error('请使用 2.2.3 或以上的基础库以使用云能力');
} else {
wx.cloud.init({
// env 参数说明:
// env 参数说明:
// env 参数决定接下来小程序发起的云开发调用(wx.cloud.xxx)会默认请求到哪个云环境的资源
// 此处请填入环境 ID, 环境 ID 可打开云控制台查看
// 如不填则使用默认环境(第一个创建的环境)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ const { init } = require('@cloudbase/wx-cloud-client-sdk')
const client = init(wx.cloud)
const models = client.models
Page({
// wx391dea168d3accf2 10000151295117
data: {
menuPosition: wx.getMenuButtonBoundingClientRect(),
menuItems: [
Expand All @@ -28,6 +27,9 @@ Page({
},
async onLoad(){
try{
wx.showLoading({
title: '',
})
// 查询店铺首页了列表
const {data:{records:storeList,total:storeTotal}} = await models.store_home_3bzb1t4.list({
filter: {
Expand All @@ -46,20 +48,20 @@ Page({
pageNumber: 1, // 第几页
getCount: true, // 开启用来获取总数
});
wx.hideLoading()
this.setData({
storeList,
storeTotal,
productList,
productTotal,
tipShow:true,
isPreview:false,
title:"使用云模板管理微信小店",
desc:"您已成功配置后台数据,可以打开下方地址对微信小店及商品进行增删改查等数据管理,配置后的数据将同步到该模板",
url:"https://tcb.cloud.tencent.com/cloud-admin#/management/content-mgr/index"
})
}catch(e){
wx.hideLoading()
this.setData({
tipShow:true,
isPreview:true,
title:"使用云模板快速接入微信小店",
desc:"当前为体验数据,切换为真实数据请复制下方链接并在浏览器中打开,帮您快速接入微信小店,管理小店及商品数据",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
<image bind:tap="onOpenTipsModal" src="../../images/shop_home.png" mode="widthFix" style="width: 100%;"></image>
</block>
<block wx:else>
<view wx:if="{{storeList.length===0}}" class="empty-tip">
暂无小店信息,可前往<text bind:tap="onOpenTipsModal" style="text-decoration: underline;color: #0052D9;">云后台内容管理</text>进行配置
</view>
<block wx:for="{{storeList}}" wx:key="appid">
<store-home appid="{{item.appid}}"></store-home>
</block>
Expand All @@ -26,9 +29,12 @@
<image bind:tap="onOpenTipsModal" src="../../images/shop_product.png" mode="widthFix" style="width: 100%;">商品展示(预览数据)</image>
</block>
<block wx:else>
<block wx:for="{{productList}}" wx:key="product_id">
<store-product appid="{{item.appid}}" product-id="{{item.product_id}}" product-promotion-link="{{item.product_promotion_link}}"></store-product>
</block>
<view wx:if="{{productList.length===0}}" class="empty-tip">
暂无商品信息,可前往<text bind:tap="onOpenTipsModal" style="text-decoration: underline; color: #0052D9;">云后台内容管理</text>进行配置
</view>
<block wx:for="{{productList}}" wx:key="product_id">
<store-product appid="{{item.appid}}" product-id="{{item.product_id}}" product-promotion-link="{{item.product_promotion_link}}"></store-product>
</block>
</block>
</block>
</view>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,9 @@
}
.tabs-body{
padding-top: 16px;
}
.empty-tip{
text-align: center;
font-size: 14px;
font-weight: 300;
}
2 changes: 1 addition & 1 deletion miniprogram/tcb-demo-mpToWxStore/project.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"packNpmRelationList": [],
"minifyWXSS": true
},
"appid": "wxc35ad965824811ef",
"appid": "",
"projectname": "quickstart-wx-cloud",
"libVersion": "latest",
"cloudfunctionTemplateRoot": "cloudfunctionTemplate/",
Expand Down

0 comments on commit cc3f6b5

Please sign in to comment.