diff --git a/app.js b/app.js
index 0b9b17a..ef0930c 100644
--- a/app.js
+++ b/app.js
@@ -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
diff --git a/assets/font/chalkboard.ttf b/assets/font/chalkboard.ttf
new file mode 100644
index 0000000..b003b87
Binary files /dev/null and b/assets/font/chalkboard.ttf differ
diff --git a/pages/settings/feedback/feedback.js b/pages/settings/feedback/feedback.js
index 0c37033..81575f3 100644
--- a/pages/settings/feedback/feedback.js
+++ b/pages/settings/feedback/feedback.js
@@ -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
+ });
}
+
})
\ No newline at end of file
diff --git a/pages/settings/feedback/feedback.wxml b/pages/settings/feedback/feedback.wxml
index 130af33..6adfe57 100644
--- a/pages/settings/feedback/feedback.wxml
+++ b/pages/settings/feedback/feedback.wxml
@@ -1,2 +1,8 @@
-
-pages/settings/feedback/feedback.wxml
+
+ 问题描述
+
+
+ 联系方式
+
+
+
\ No newline at end of file
diff --git a/pages/settings/feedback/feedback.wxss b/pages/settings/feedback/feedback.wxss
index 8da03f0..5bbdb4f 100644
--- a/pages/settings/feedback/feedback.wxss
+++ b/pages/settings/feedback/feedback.wxss
@@ -1 +1,44 @@
-/* pages/settings/feedback/feedback.wxss */
\ No newline at end of file
+.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;
+}
diff --git a/pages/settings/settings.js b/pages/settings/settings.js
index abf7c23..feb435a 100644
--- a/pages/settings/settings.js
+++ b/pages/settings/settings.js
@@ -27,7 +27,7 @@ Page({
showMyWord: function () {
wx.showModal({
title: '提示',
- content: '由于我的失误,将本月3次配置服务器的机会浪费完了,所以该功能下个月开放!请见谅!',
+ content: '此功能暂未开放,敬请期待!',
showCancel: false,
success: function (res) {
if (res.confirm) {
@@ -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
}
})
}
diff --git a/pages/word/word.wxss b/pages/word/word.wxss
index 461c34d..4b6a1db 100644
--- a/pages/word/word.wxss
+++ b/pages/word/word.wxss
@@ -1,3 +1,7 @@
+@font-face {
+font-family: Chalkboard;
+src: url('/assets/font/chalkboard.ttf'),
+}
.container {
display: flex;
diff --git a/utils/hotapp-conf.js b/utils/hotapp-conf.js
new file mode 100644
index 0000000..2f446d9
--- /dev/null
+++ b/utils/hotapp-conf.js
@@ -0,0 +1,2 @@
+exports.hotAppKey='hotapp81448114'; //小程序在hotapp平台注册的appKey
+exports.appVer='0.1.0'; //本地小程序的版本号,用来区分错误统计
diff --git a/utils/hotapp.js b/utils/hotapp.js
new file mode 100644
index 0000000..11890c0
--- /dev/null
+++ b/utils/hotapp.js
@@ -0,0 +1 @@
+!function(){"use strict";function e(e,t,n){if(!A)return void d("app key is empty");var o=I+"/api/error",r={appkey:A,system_info:g.getSystemInfo(),user_info:g.getUserInfo(),version:t,msg:e};return[o,r,n]}function t(){return 1===parseInt(g.get("wxAuth"))}function n(e){o();var t=function(){var t=g.getFakeOpenID();return"function"==typeof e&&e(t)};wx.login({success:function(n){return n.code?void wx.request({url:I+"/data/wechat/login",data:{hotAppKey:A,code:n.code},method:"POST",success:function(t){var n=t.data.openid;return l.isEmpty(n)&&(n=g.getFakeOpenID()),g.setOpenID(n),"function"==typeof e&&e(n)},fail:t}):t()},fail:t})}function o(e){void 0===e&&(e=A);var t="hotAppKey不能为空";if(l.isEmpty(e))throw wx.showToast({title:t}),Error(t)}function r(e,r){e=e||g.getHotAppKey(),o(e),g.set("hotAppKey",e),d("hotAppKey: "+A+" 已初始化");var p=function(){t()?(d("conf.wxAuth disable our auth dialog"),g.set("userInfo",{}),a()):wx.getUserInfo({success:function(e){g.set("userInfo",e.userInfo),a()}})},i=g.getOpenID();return i?p():void n(p)}function a(){wx.request({url:I+"/data/wechat/launch",data:{hotAppKey:A,openId:g.getOpenID(),hotAppUUID:g.getHotAppUUID(),userInfo:g.getUserInfo(),systemInfo:g.getSystemInfo(),phoneTime:Date.parse(new Date)/1e3,hotAppVersion:g.getVersion()},method:"POST",success:function(e){var t=g.get("uploadType");if(0==t)g.set("uploadType",e.data.upload_type);else{var n=wx.getStorageSync("hotAppEvent")||[];if(0==n.length)return;wx.request({url:I+"/data/wechat/event",data:{hotAppKey:A,openId:g.getOpenID(),hotAppUUID:g.getHotAppUUID(),eventArray:n},method:"POST",success:function(e){d(wx.getStorageSync("hotAppEvent")||[],e.data);try{wx.removeStorageSync("hotAppEvent")}catch(e){d(e)}},fail:function(){d("send event fail"),wx.setStorageSync("hotAppEvent",n)}})}},fail:function(e){d("send launch fail: ",e)}})}function p(e,t){t=void 0===t?"":t;var n=g.getHotAppKey(),o=g.get("uploadType"),r=g.getHotAppHost();if(n){var a=wx.getStorageSync("hotAppEvent")||[],p={eventId:e,eventValue:t,phoneTime:Date.parse(new Date)/1e3};a.push(p),0!=o?wx.setStorageSync("hotAppEvent",a):wx.request({url:r+"/data/wechat/event",data:{hotAppKey:g.getHotAppKey(),openId:g.getOpenID(),hotAppUUID:g.getHotAppUUID(),eventArray:a,hotAppVersion:g.getVersion()},method:"POST",success:function(e){d("hotAppEvent",wx.getStorageSync("hotAppEvent")||[]);try{wx.removeStorageSync("hotAppEvent")}catch(e){d("remove hotAppEvent failed",e)}},fail:function(){d("send event fail"),wx.setStorageSync("hotAppEvent",a)}})}else d("hotappkey is empty")}function i(e,t){g.validKey(["hotAppHost","hotAppKey"]);var n=g.getHotAppHost(),o=n+"/api/searchkey",r={appkey:g.get("hotAppKey")};l.map(e,function(e,t){r[e]=t}),y.http(o,r,t)}function u(e,t,n,o){var r=g.getSystemInfo(),a=g.getUserInfo(),p=g.getHotAppHost();if(l.isEmpty(a))return d("userinfo is empty"),"function"==typeof o&&o(!1);var i=p+"/api/feedback",u={appkey:g.getHotAppKey(),content:e,openid:g.getOpenID()?g.getOpenID():g.getFakeOpenID(),content_type:t,contract_info:n,system_info:r,user_info:a};y.http(i,u,o)}function c(e){wx.chooseImage({success:function(t){d(t);var n=t.tempFilePaths;wx.uploadFile({url:I+"/api/feedback/image/upload",filePath:n[0],name:"file",formData:{appkey:A},success:function(t){var n=t.data;return l.assert.isString(t.data)&&(n=JSON.parse(t.data)),0==n.ret?"function"==typeof e&&e(n.image_url):"function"==typeof e&&e(!1)},fail:function(t){return"function"==typeof e&&e(!1)}})},fail:function(t){return d("choose img failed"),"function"==typeof e&&e(!1)}})}function s(e,t){if("object"!=typeof e||!e.__route__)return void d("context error");if(!A)return void d("hotapp key is empty");var n=e.__route__,o=setInterval(function(){var e=g.getOpenID(),t=g.getUserInfo();l.isEmpty(e)||l.isEmpty(t)||(clearInterval(o),d("clear timer check_env, trigger page onload event"),r(e,t))},200),r=function(e,o){var r=I+"/data/wechat/param",a={hotAppKey:A,page:n,openId:e,hotAppUUID:g.getHotAppUUID(),paraInfo:t};a.paraInfo.userInfo=o,y.http(r,a)}}function f(e,t){if(!A)return void d("hotapp key is empty");if("object"!=typeof e||!e.__route__)return void d("context error, must be in Page instance scope");var n=t.path,o=g.getOpenID();o||(o=g.getFakeOpenID(),d("shareMessage use fake openId: "+o));var r=I+"/data/wechat/share",a=function(e){var t={},n=e.indexOf("?");if(!v.isString(e)||n===-1)return t;var o=e.substring(n+1),r=o.split("&");return l.map(r,function(e){var n=e.split("=");t[n[0]]=n[1]||""}),t},p=a(n);d("shareMessage params: ",p);var i={hotAppKey:A,page:e.__route__,openId:o,hotAppUUID:g.getHotAppUUID(),params:p};y.http(r,i);var u=n.indexOf("?")===-1?n:n.substring(0,n.indexOf("?"))+("?hotapp_share_id="+o);if(v.isObject(p)&&!l.isEmpty(p)){var c=[];Object.keys(p).forEach(function(e){c.push(e+"="+encodeURIComponent(p[e]))}),u+="&"+c.join("&")}return d("shareUrl: ",u),t.path=u,t}function h(e,t,n){if(e[t]){var o=e[t],r=3,a=0;e[t]=function(e){if("onShareAppMessage"==t){if(!o||!v.isFunction(o))return;var p=o.apply(this,arguments);return n.call(this,p)}if("onError"==t){var i=n.apply(this,arguments);if(v.isArray(i)&&v.isObject(i[1])){if(a>r)return d("maxRequest ",r,"times achieved"),void o.call(this,e);var u=i[0],c=i[1],s=["getStorageSync:fail"];if(l.inArray(c.msg,s))return o.call(this,e);try{y.http(u,c,function(e,t){v.isObject(e)?d("send err log ok, err data: ",e,t):!1===e&&(d("err occurred",t),++a)})}catch(e){d("onError",e)}}return o.call(this,e)}return n.call(this,e,t),o.call(this,e)}}}var l=function(){function e(e,t){return!!p.isArray(t)&&t.indexOf(e)!==-1}function t(e,t){return t=t||{},p.shouldBe("object",e),p.shouldBe("object",t),i(t,function(t,n){e[t]=n}),e}function n(e){return p.isObject(e)?0===Object.getOwnPropertyNames(e).length:p.isArray(e)?0===e.length:!e}var o=Object.prototype.toString,r=Object.prototype.hasOwnProperty,a=Array.prototype.slice,p=function(){function t(t,o){var r=["function","object","array","string","number","boolean"];if(!e(t,r))throw Error("unknown type: "+t);var p=a.call(arguments),i="is"+t[0].toUpperCase()+t.substring(1);if(n[i]){if(!n[i].call(null,o))throw Error("argument#"+p.indexOf(o)+" should be "+t+", "+typeof o+" given");return!0}throw Error("Unregistered function: "+i)}var n={isFunction:function(e){return"[object Function]"===o.call(e)},isObject:function(e){return"[object Object]"===o.call(e)},isArray:function(e){return"[object Array]"===o.call(e)},isString:function(e){return"[object String]"===o.call(e)},isNumber:function(e){return"[object Number]"===o.call(e)},isBoolean:function(e){return"[object Boolean]"===o.call(e)}};return n.shouldBe=t,n}(),i=function(e,t){if(p.isObject(e))for(var n in e)r.call(e,n)&&t.call(null,n,e[n]);else if(p.isArray(e))for(var o=0,a=e.length;o0){d("app ttl, ",e);var t=o+"/data/wechat/time",r={time:e,hotAppKey:g.getHotAppKey(),hotAppUUID:g.getHotAppUUID(),openId:g.getOpenID()};d("send app ttl request ",r),y.http(t,r)}}),h(t,"onError",function(t){return e(t,g.get("appVer")||"0.1.0")}),m(t)};var w=Page;Page=function(e){h(e,"onReady",function(){}),h(e,"onLoad",function(){var e=arguments[0];s(this,e)}),h(e,"onUnload",function(){}),h(e,"onShow",function(){d("page show")}),h(e,"onHide",function(){d("page hide")}),"onShareAppMessage"in e&&h(e,"onShareAppMessage",function(e){var t=this.__route__;return d("page onShareAppMessage: "+t),e=e||{title:"ZM-title",desc:"ZM-desc",path:"/"===t[0]?t:"/"+t},f(this,e)}),w(e)},module.exports={init:r,onEvent:p,onError:e,onLoad:s,onShare:f,setEventUploadType:g.setEventUploadType,clearData:g.clearData,wxlogin:n,getFakeOpenID:g.getFakeOpenID,getOpenID:g.getOpenID,getPrefix:g.getPrefix,genPrimaryKey:g.genPrimaryKey,replaceOpenIdKey:g.replaceOpenIdKey,searchkey:i,get:y.get,post:y.post,del:y.del,request:y.request,getVersion:g.getVersion,setDebug:g.setDebug,feedback:u,uploadFeedbackImage:c,log:d}}();
\ No newline at end of file