{
+ that.setData({
+
+ value1:'',
+ value2:'',
+ tempFilePaths:[],
+ nowCount:0
+ })
+ wx.showToast({
+ title: '发布成功',
+ })}})
}
},fail:res=>{
console.log(res);
}
})
+
}
}
+ wx.switchTab({
+ url: '../index/index',
+
+ })
},
@@ -257,28 +337,7 @@ Page({
* 生命周期函数--监听页面显示
*/
onShow: function () {
- let openid = wx.getStorageSync('openid');
- let userinfo = wx.getStorageSync('userinfo');
- console.log(openid);
- if(openid=="" || openid==null){
- wx.showToast({
- title: '请先登陆',
- duration:1000,
- icon:"none",
- success:function(e){
- setTimeout(function() {
- wx.switchTab({
- url: '/pages/me/me',
- })
- }, 1000);
- }
- })
- }else{
- this.setData({
- openid:openid,
- userinfo:userinfo
- })
- }
+
},
/**
@@ -314,5 +373,40 @@ Page({
*/
onShareAppMessage: function () {
- }
+ },
+ onAdd_s: function () {
+
+ wx.cloud.init({
+ env: 'cloud1-8g5wmepxce8a3b8a'
+ });
+ const db = wx.cloud.database()
+ db.collection('tiezi').add({
+ data: {
+ title:title,
+ content:content,
+ openid:that.data.openid,
+ url:[],
+ },
+ success: res => {
+ // 在返回结果中会包含新创建的记录的 _id
+ this.setData({
+ counterId: res._id,
+ count: 1
+ })
+ wx.showToast({
+ title: '成功扔进树洞~',
+ })
+ console.log('[数据库] [留言] 成功,记录 _id: ', res._id)
+ },
+ fail: err => {
+ wx.showToast({
+ icon: 'none',
+ title: '种种原因树洞拒绝了~'
+ })
+ console.error('[数据库] [新增记录] 失败:', err)
+ }
+ })
+
+ }
+
})
\ No newline at end of file
diff --git a/scr/论坛/pages/submit/submit.json b/scr/lt2/pages/submit/submit.json
similarity index 100%
rename from scr/论坛/pages/submit/submit.json
rename to scr/lt2/pages/submit/submit.json
diff --git a/scr/论坛/pages/submit/submit.wxml b/scr/lt2/pages/submit/submit.wxml
similarity index 78%
rename from scr/论坛/pages/submit/submit.wxml
rename to scr/lt2/pages/submit/submit.wxml
index 2837ae9..7c255de 100644
--- a/scr/论坛/pages/submit/submit.wxml
+++ b/scr/lt2/pages/submit/submit.wxml
@@ -2,12 +2,7 @@