微信小程序前端代碼 :
index.js中page的onload函數。
onLoad: function () {
wx.request({
微信小程序實現數據庫管理,url: 'http://localhost:8080/BaseProjectSSM/admin/clazz_table/list2',
method: 'post',
header: {
'content-type': 'application/json' // 默認值
},
nodejs后端框架,success: res => {
console.log(res.data)
this.setData({
})
},
php websocket框架、fail: res => {
console.log("失敗")
}
})
if (app.globalData.userInfo) {
微信小程序交互、this.setData({
userInfo: app.globalData.userInfo,
hasUserInfo: true
})
} else if (this.data.canIUse){
Java微服務,// 由于 getUserInfo 是網絡請求,可能會在 Page.onLoad 之后才返回
// 所以此處加入 callback 以防止這種情況
app.userInfoReadyCallback = res => {
this.setData({
userInfo: res.userInfo,
java微服務開發?hasUserInfo: true
})
}
} else {
// 在沒有 open-type=getUserInfo 版本的兼容處理
ssm添加好友功能、wx.getUserInfo({
success: res => {
app.globalData.userInfo = res.userInfo
this.setData({
userInfo: res.userInfo,
微信小程序、hasUserInfo: true
})
}
})
}
微信小程序前后端ssm搭建,},
微信控制臺結果:
后臺代碼:
控制層:
@RequestMapping(value="/list2",method=RequestMethod.POST)
微信小程序后端部署,@ResponseBody
public MapgetList2(){
Mapret = new HashMap();
Listclazz1 = clazzService.findList2();
ret.put("clazzList2", clazz1);
微信小程序后端怎么搭建,return ret;
}
service.java文件
public ListfindList2();
serviceImpl.java文件
java后端實現微信小程序登錄。@Override
public ListfindList2() {
// TODO Auto-generated method stub
return clazzDao.findList2();
}
dao.java文件
public ListfindList2();
clazz.java實體類
package com.ischoolbar.programmer.entity.admin;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import org.springframework.stereotype.Component;
/**
* 課程實體
* @author whs
*
*/
@Component
public class Clazz {
private Long id;
private String clazzname;//課程名字
private Long categoryId;//分類id
private ClazzCategory clazzCategory;//課程類別
private Long addressId;//課程地址
private String teacher;//教師
private Date clazzTime;//上課時間
private Integer duration; //時長
private String weekday;//星期
private String cost;//費用
private String remark;//備注
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getClazzname() {
return clazzname;
}
public void setClazzname(String clazzname) {
this.clazzname = clazzname;
}
public Long getCategoryId() {
return categoryId;
}
public void setCategoryId(Long categoryId) {
this.categoryId = categoryId;
}
public ClazzCategory getClazzCategory() {
return clazzCategory;
}
public void setClazzCategory(ClazzCategory clazzCategory) {
this.clazzCategory = clazzCategory;
}
public Long getAddressId() {
return addressId;
}
public void setAddressId(Long addressId) {
this.addressId = addressId;
}
public String getTeacher() {
return teacher;
}
public void setTeacher(String teacher) {
this.teacher = teacher;
}
public Date getClazzTime() {
return clazzTime;
}
public void setClazzTime(String clazzTime) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
try {
this.clazzTime = sdf.parse(clazzTime);
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public Integer getDuration() {
return duration;
}
public void setDuration(Integer duration) {
this.duration = duration;
}
public String getWeekday() {
return weekday;
}
public void setWeekday(String weekday) {
this.weekday = weekday;
}
public String getCost() {
return cost;
}
public void setCost(String cost) {
this.cost = cost;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
}
mapper.xml文件
select * from clazz where 1 = 1
數據庫:
版权声明:本站所有资料均为网友推荐收集整理而来,仅供学习和研究交流使用。
工作时间:8:00-18:00
客服电话
电子邮件
admin@qq.com
扫码二维码
获取最新动态