小程序
小游戏
企业微信
微信支付
扫描小程序码分享
初始加载
点击页面后
2 个回答
加粗
标红
插入代码
插入链接
插入图片
上传视频
我也有类似问题,请问是如何解决的
你好,麻烦通过点击下方“反馈信息”按钮,提供出现问题的。
麻烦提供能复现问题的代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)
const App = getApp()
Page({
data: {
isLogin: false,
isRegister: false,
isInfoComplete: false,
showUserDialog: false,
showPop: false,
locale: {},
orders: [],
order: null,
product: null,
selectedOrderIndex: null,
stepImage: App.Config.OSSUrl + "/images/i18n/zh/main-process/default.png",
info: [],
imgurls: ['https://cell-wxapp.oss-cn-shenzhen.aliyuncs.com/images/dental-cells-bg.png',
'https://cell-wxapp.oss-cn-shenzhen.aliyuncs.com/images/dental-cells-bg.png',
'https://cell-wxapp.oss-cn-shenzhen.aliyuncs.com/images/dental-cells-bg.png',],
suspicions: [],
mainInfo: [0, 0, 0, 0, 0],
pageShow: true,
currentSwiper:0,
news: [{
title: '免疫细胞-抗衰老卫士',
summary: '衰老是一种自然的过程,生物分子自然交联学说对此做过比较系统的阐述,该学说在某杂志',
image: 'https://cell-wxapp.oss-cn-shenzhen.aliyuncs.com/images/dental-cells-bg.png',
}, {
}],
imgs:["https://cell-wxapp.oss-cn-shenzhen.aliyuncs.com/images/banner/banner-switch-01.png","https://cell-wxapp.oss-cn-shenzhen.aliyuncs.com/images/banner/banner-switch-06.png", ],
},
swiperChange(e) {
let current = e.detail.current;
// console.log(current, '轮播图')
let that = this;
that.setData({
currentSwiper: current,
})
/**
* 生命周期函数--监听页面加载
*/
onLoad: function () {
App.MTA.Page.init();
this.getProduct();
* 生命周期函数--监听页面显示
onShow: function () {
this.setData({
isLogin: App.globalData.isLogin,
isRegister: App.globalData.userInfo != null && App.globalData.userInfo.wechatName != null && App.globalData.userInfo.avatarUrl != null,
isInfoComplete: App.globalData.userInfo != null && App.globalData.userInfo.phone != null && App.globalData.userInfo.idType && App.globalData.userInfo.idNum && App.globalData.userInfo.address != null,
pageShow: true
});
this.initBanner()
this.getInfo()
* 生命周期函数--监听页面隐藏
onHide: function () {
pageShow: false
* 页面初始化
initBanner: function () {
//this.getProduct();
/*if (this.data.isLogin && this.data.register && this.data.isInfoComplete) {
//用户登录获取订单
this.getHomeOrders();
} else {
if (!this.data.isRegister || !this.data.isInfoComplete) {
//用户未注册或信息不完善时获取产品
return
App.login(() => {
}, () => {
}
}*/
* 重置首页订单信息,例如:取消唯一的订单时
resetOrder: function () {
stepImage: App.Config.OSSUrl + `/images/i18n/zh/main-process/default.png?001`,
*首页轮播图加载
getProduct:function(){
App.MainHttpService.indexPic().then(res => {
console.log("222222222");
console.log(res.code);
if(res.code === 2000){
if(res.data.length > 0){
res.data.forEach(item => {
item.url = App.Tools.formatImage(App.Config.OSSUrl,App.Config.BaseImgURL,item.url);
imgurls: res.data
}else{
App.Toast("获取产品信息失败");
}).catch(err => {
console.log(err);
<view class="project-itme">
<view class="project-banner">
<view class="project-banner-image">
<swiper indicator-dots="{{false}}" autoplay="{{true}}" current="{{currentSwiper}}" bindchange="swiperChange">
<block wx:for="{{imgurls}}">
<swiper-item>
<image class="banner-image" src='{{item.url}}'></image>
</swiper-item>
</block>
</swiper>
<!--重置小圆点的样式 -->
<view class="dots">
<view class="dot{{index == currentSwiper ? ' active' : ''}}"></view>
</view>
小点样式 是我自定义的
代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)这个格式的代码片段
现在项目不能完整的跑起来...已经有解决方案了,多谢
关注后,可在微信内接收相应的重要提醒。
请使用微信扫描二维码关注 “微信开放社区” 公众号
我也有类似问题,请问是如何解决的
麻烦提供能复现问题的代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)
const App = getApp()
Page({
data: {
isLogin: false,
isRegister: false,
isInfoComplete: false,
showUserDialog: false,
showPop: false,
locale: {},
orders: [],
order: null,
product: null,
selectedOrderIndex: null,
stepImage: App.Config.OSSUrl + "/images/i18n/zh/main-process/default.png",
info: [],
imgurls: ['https://cell-wxapp.oss-cn-shenzhen.aliyuncs.com/images/dental-cells-bg.png',
'https://cell-wxapp.oss-cn-shenzhen.aliyuncs.com/images/dental-cells-bg.png',
'https://cell-wxapp.oss-cn-shenzhen.aliyuncs.com/images/dental-cells-bg.png',
'https://cell-wxapp.oss-cn-shenzhen.aliyuncs.com/images/dental-cells-bg.png',
'https://cell-wxapp.oss-cn-shenzhen.aliyuncs.com/images/dental-cells-bg.png',],
suspicions: [],
mainInfo: [0, 0, 0, 0, 0],
pageShow: true,
currentSwiper:0,
news: [{
title: '免疫细胞-抗衰老卫士',
summary: '衰老是一种自然的过程,生物分子自然交联学说对此做过比较系统的阐述,该学说在某杂志',
image: 'https://cell-wxapp.oss-cn-shenzhen.aliyuncs.com/images/dental-cells-bg.png',
}, {
title: '免疫细胞-抗衰老卫士',
summary: '衰老是一种自然的过程,生物分子自然交联学说对此做过比较系统的阐述,该学说在某杂志',
image: 'https://cell-wxapp.oss-cn-shenzhen.aliyuncs.com/images/dental-cells-bg.png',
}, {
title: '免疫细胞-抗衰老卫士',
summary: '衰老是一种自然的过程,生物分子自然交联学说对此做过比较系统的阐述,该学说在某杂志',
image: 'https://cell-wxapp.oss-cn-shenzhen.aliyuncs.com/images/dental-cells-bg.png',
}, {
title: '免疫细胞-抗衰老卫士',
summary: '衰老是一种自然的过程,生物分子自然交联学说对此做过比较系统的阐述,该学说在某杂志',
image: 'https://cell-wxapp.oss-cn-shenzhen.aliyuncs.com/images/dental-cells-bg.png',
}],
imgs:["https://cell-wxapp.oss-cn-shenzhen.aliyuncs.com/images/banner/banner-switch-01.png","https://cell-wxapp.oss-cn-shenzhen.aliyuncs.com/images/banner/banner-switch-06.png", ],
},
swiperChange(e) {
let current = e.detail.current;
// console.log(current, '轮播图')
let that = this;
that.setData({
currentSwiper: current,
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function () {
App.MTA.Page.init();
this.getProduct();
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
this.setData({
isLogin: App.globalData.isLogin,
isRegister: App.globalData.userInfo != null && App.globalData.userInfo.wechatName != null && App.globalData.userInfo.avatarUrl != null,
isInfoComplete: App.globalData.userInfo != null && App.globalData.userInfo.phone != null && App.globalData.userInfo.idType && App.globalData.userInfo.idNum && App.globalData.userInfo.address != null,
pageShow: true
});
this.initBanner()
this.getInfo()
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
this.setData({
pageShow: false
});
},
/**
* 页面初始化
*/
initBanner: function () {
//this.getProduct();
/*if (this.data.isLogin && this.data.register && this.data.isInfoComplete) {
//用户登录获取订单
this.getHomeOrders();
} else {
if (!this.data.isRegister || !this.data.isInfoComplete) {
//用户未注册或信息不完善时获取产品
this.getProduct();
return
} else {
App.login(() => {
this.getHomeOrders();
}, () => {
this.getProduct();
})
}
}*/
},
/**
* 重置首页订单信息,例如:取消唯一的订单时
*/
resetOrder: function () {
this.setData({
orders: [],
order: null,
stepImage: App.Config.OSSUrl + `/images/i18n/zh/main-process/default.png?001`,
})
},
/**
*首页轮播图加载
*/
getProduct:function(){
App.MainHttpService.indexPic().then(res => {
console.log("222222222");
console.log(res.code);
if(res.code === 2000){
if(res.data.length > 0){
res.data.forEach(item => {
item.url = App.Tools.formatImage(App.Config.OSSUrl,App.Config.BaseImgURL,item.url);
this.setData({
imgurls: res.data
})
})
}
}else{
App.Toast("获取产品信息失败");
}
}).catch(err => {
console.log(err);
App.Toast("获取产品信息失败");
});
},
<view class="project-itme">
<view class="project-banner">
<view class="project-banner-image">
<swiper indicator-dots="{{false}}" autoplay="{{true}}" current="{{currentSwiper}}" bindchange="swiperChange">
<block wx:for="{{imgurls}}">
<swiper-item>
<image class="banner-image" src='{{item.url}}'></image>
</swiper-item>
</block>
</swiper>
<!--重置小圆点的样式 -->
<view class="dots">
<block wx:for="{{imgurls}}">
<view class="dot{{index == currentSwiper ? ' active' : ''}}"></view>
</block>
</view>
</view>
</view>
小点样式 是我自定义的
代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)这个格式的代码片段
现在项目不能完整的跑起来...已经有解决方案了,多谢