Skip to content

Commit

Permalink
实现用户反馈,对接数据统计
Browse files Browse the repository at this point in the history
  • Loading branch information
airingursb committed Jan 31, 2017
1 parent ae8ae92 commit 87b7b17
Show file tree
Hide file tree
Showing 9 changed files with 138 additions and 22 deletions.
13 changes: 13 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,23 @@
//app.js

var hotapp=require('./utils/hotapp.js');
//hotapp.setDebug(true);

var wilddog=require('./utils/wilddog-weapp-all.js');
var config = {
syncURL: 'https://miemie.wilddogio.com',
authDomain: 'miemie.wilddog.com'
}

App({
onLaunch: function () {
//调用API从本地缓存中获取数据
var logs = wx.getStorageSync('logs') || []
logs.unshift(Date.now())
wx.setStorageSync('logs', logs)

wilddog.initializeApp(config)

},
getUserInfo:function(cb){
var that = this
Expand Down
Binary file added assets/font/chalkboard.ttf
Binary file not shown.
65 changes: 55 additions & 10 deletions pages/settings/feedback/feedback.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,67 @@
// pages/settings/feedback/feedback.js

var wilddog = require('../../../utils/wilddog-weapp-all')
var config = {
syncURL: 'https://miemie.wilddogio.com',
authDomain: 'miemie.wilddog.com'
}
var app = getApp()


Page({
data:{},
onLoad:function(options){
data: {
userInfo: {},
content: "",
connect: ""
},
onLoad: function (options) {

const that = this;
// 页面初始化 options为页面跳转所带来的参数
app.getUserInfo(function (userInfo) {
that.setData({
userInfo: userInfo
})
})
},
onReady:function(){
// 页面渲染完成
getContent: function (e) {
this.setData({
content: e.detail.value
})
},
onShow:function(){
// 页面显示
getConnection: function (e) {
this.setData({
connect: e.detail.value
})
},
onHide:function(){
// 页面隐藏
getNowFormatDate: function () {
var date = new Date();
var seperator1 = "-";
var seperator2 = ":";
var month = date.getMonth() + 1;
var strDate = date.getDate();
if (month >= 1 && month <= 9) {
month = "0" + month;
}
if (strDate >= 0 && strDate <= 9) {
strDate = "0" + strDate;
}
var currentdate = date.getFullYear() + seperator1 + month + seperator1 + strDate
+ " " + date.getHours() + seperator2 + date.getMinutes()
+ seperator2 + date.getSeconds();
return currentdate;
},
onUnload:function(){
// 页面关闭
submitSuggestion: function () {
wilddog.initializeApp(config)
var ref = wilddog.sync().ref("/web/saving-data/feedback");
// child() 用来定位到某个节点。

var currentdate = this.getNowFormatDate()
ref.child(currentdate).set({
"content": this.data.content,
"connect": this.data.connect,
"user": this.data.userInfo.nickName
});
}

})
10 changes: 8 additions & 2 deletions pages/settings/feedback/feedback.wxml
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
<!--pages/settings/feedback/feedback.wxml-->
<text>pages/settings/feedback/feedback.wxml</text>
<view class="container">
<text class="feedback-label">问题描述</text>

<textarea class="feedback-text" placeholder="请详细你所遇到的问题" bindblur="getContent"/>
<text class="connect-label">联系方式</text>
<textarea class="connect-text" placeholder="请留下您的联系方式(QQ/微信/电话/等)" bindblur="getConnection"/>
<button class="feedback-button" bindtap="submitSuggestion">提交</button>
</view>
45 changes: 44 additions & 1 deletion pages/settings/feedback/feedback.wxss
Original file line number Diff line number Diff line change
@@ -1 +1,44 @@
/* pages/settings/feedback/feedback.wxss */
.container {
display: flex;
flex-direction: column;
align-items: center;
height: 100%;
justify-content: space-between;
box-sizing: border-box;
}

.feedback-label {
float: left;
margin-top: 40rpx;
font-size: 32rpx;
}

.feedback-text {
margin-top: 40rpx;
background-color: #fff;
padding: 30rpx;
font-size: 32rpx;
width: 80%;
border-radius: 10rpx;
}

.connect-label {
margin-top: 60rpx;
font-size: 32rpx;
}

.connect-text {
margin-top: 40rpx;
background-color: #fff;
padding: 30rpx;
font-size: 32rpx;
width: 80%;
height: 80rpx;
border-radius: 10rpx;
}

.feedback-button {
margin-top: 80rpx;
width: 88%;
font-size: 38rpx;
}
20 changes: 11 additions & 9 deletions pages/settings/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Page({
showMyWord: function () {
wx.showModal({
title: '提示',
content: '由于我的失误,将本月3次配置服务器的机会浪费完了,所以该功能下个月开放!请见谅!',
content: '此功能暂未开放,敬请期待!',
showCancel: false,
success: function (res) {
if (res.confirm) {
Expand Down Expand Up @@ -65,14 +65,16 @@ Page({
})
},
showFeedback: function () {
wx.showModal({
title: '提示',
content: '由于我的失误,将本月3次配置服务器的机会浪费完了,所以该功能下个月开放!请见谅!',
showCancel: false,
success: function (res) {
if (res.confirm) {
console.log('用户点击确定')
}
wx.navigateTo({
url: './feedback/feedback',
success: function(res){
// success
},
fail: function() {
// fail
},
complete: function() {
// complete
}
})
}
Expand Down
4 changes: 4 additions & 0 deletions pages/word/word.wxss
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
@font-face {
font-family: Chalkboard;
src: url('/assets/font/chalkboard.ttf'),
}

.container {
display: flex;
Expand Down
2 changes: 2 additions & 0 deletions utils/hotapp-conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
exports.hotAppKey='hotapp81448114'; //小程序在hotapp平台注册的appKey
exports.appVer='0.1.0'; //本地小程序的版本号,用来区分错误统计
1 change: 1 addition & 0 deletions utils/hotapp.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 87b7b17

Please sign in to comment.