-
Notifications
You must be signed in to change notification settings - Fork 118
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
57fed47
commit 7e46e37
Showing
11 changed files
with
115 additions
and
243 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,40 @@ | ||
//app.js | ||
// app.js | ||
|
||
var hotapp=require('./utils/hotapp.js'); | ||
//hotapp.setDebug(true); | ||
const hotapp = require('./utils/hotapp.js') | ||
// hotapp.setDebug(true) | ||
|
||
var wilddog=require('./utils/wilddog-weapp-all.js'); | ||
var config = { | ||
const wilddog = require('./utils/wilddog-weapp-all.js') | ||
const config = { | ||
syncURL: 'https://miemie.wilddogio.com', | ||
authDomain: 'miemie.wilddog.com' | ||
} | ||
|
||
App({ | ||
onLaunch: function () { | ||
//调用API从本地缓存中获取数据 | ||
var logs = wx.getStorageSync('logs') || [] | ||
onLaunch: () => { | ||
// 调用 API 从本地缓存中获取数据 | ||
const logs = wx.getStorageSync('logs') || [] | ||
logs.unshift(Date.now()) | ||
wx.setStorageSync('logs', logs) | ||
|
||
wilddog.initializeApp(config) | ||
|
||
}, | ||
getUserInfo:function(cb){ | ||
var that = this | ||
if(this.globalData.userInfo){ | ||
getUserInfo: cb => { | ||
if (this.globalData.userInfo) { | ||
typeof cb == "function" && cb(this.globalData.userInfo) | ||
}else{ | ||
//调用登录接口 | ||
} else { | ||
wx.login({ | ||
success: function () { | ||
success: () => { | ||
wx.getUserInfo({ | ||
success: function (res) { | ||
that.globalData.userInfo = res.userInfo | ||
typeof cb == "function" && cb(that.globalData.userInfo) | ||
success: res => { | ||
this.globalData.userInfo = res.userInfo | ||
typeof cb == "function" && cb(this.globalData.userInfo) | ||
} | ||
}) | ||
} | ||
}) | ||
} | ||
}, | ||
globalData:{ | ||
userInfo:null | ||
globalData: { | ||
userInfo: null | ||
} | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,22 @@ | ||
// pages/settings/detail/detail.js | ||
Page({ | ||
data:{}, | ||
onLoad:function(option){ | ||
var word = option.content | ||
data: {}, | ||
onLoad: option => { | ||
const word = option.content | ||
|
||
var that = this; | ||
wx.request({ | ||
url: 'https://api.shanbay.com/bdc/search/?word=' + word, | ||
data: {}, | ||
method: 'GET', | ||
success: function (res) { | ||
console.log(res) | ||
that.setData({ | ||
content: res.data.data.content, | ||
audio: res.data.data.audio_addresses.us[0], | ||
pron: res.data.data.pron, | ||
definition: res.data.data.definition | ||
}) | ||
}, | ||
fail: function () { | ||
}, | ||
complete: function () { | ||
} | ||
wx.request({ | ||
url: `https://api.shanbay.com/bdc/search/?word=${word}`, | ||
data: {}, | ||
method: 'GET', | ||
success: res => { | ||
const data = res.data.data | ||
this.setData({ | ||
content: data.content, | ||
audio: data.audio_addresses.us[0], | ||
pron: data.pron, | ||
definition: data.definition | ||
}) | ||
}, | ||
onReady:function(){ | ||
// 页面渲染完成 | ||
}, | ||
onShow:function(){ | ||
// 页面显示 | ||
}, | ||
onHide:function(){ | ||
// 页面隐藏 | ||
}, | ||
onUnload:function(){ | ||
// 页面关闭 | ||
} | ||
}) | ||
} | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,77 +1,35 @@ | ||
Page({ | ||
data: { | ||
|
||
}, | ||
onLoad: function (options) { | ||
// 生命周期函数--监听页面加载 | ||
|
||
}, | ||
onShareAppMessage: function () { | ||
// 用户点击右上角分享 | ||
return { | ||
title: '', // 分享标题 | ||
desc: '', // 分享描述 | ||
path: '' // 分享路径 | ||
} | ||
}, | ||
|
||
search: function (e) { | ||
var that = this | ||
var content = e.detail.value | ||
search: e => { | ||
let content = e.detail.value | ||
wx.request({ | ||
|
||
url: 'https://api.shanbay.com/bdc/search/?word=' + content, | ||
url: `https://api.shanbay.com/bdc/search/?word=${content}`, | ||
data: {}, | ||
method: 'GET', | ||
success: function (res) { | ||
console.log(res) | ||
|
||
var msg = res.data.msg | ||
success: res => { | ||
const { msg } = res.data | ||
if (msg == "SUCCESS") { | ||
wx.navigateTo({ | ||
url: './detail/detail?content=' + content, | ||
success: function (res) { | ||
// success | ||
}, | ||
fail: function () { | ||
// fail | ||
}, | ||
complete: function () { | ||
// complete | ||
} | ||
url: `./detail/detail?content=${content}` | ||
}) | ||
} else { | ||
wx.showModal({ | ||
title: '提示', | ||
content: '对不起,查询不到该词信息', | ||
showCancel: false, | ||
success: function (res) { | ||
if (res.confirm) { | ||
console.log('用户点击确定') | ||
} | ||
} | ||
showCancel: false | ||
}) | ||
} | ||
|
||
}, | ||
fail: function () { | ||
}, | ||
complete: function () { | ||
} | ||
}) | ||
|
||
}, | ||
|
||
help: function () { | ||
help: () => { | ||
wx.showModal({ | ||
title: '提示', | ||
content: '输入单词后点击回车键即可查询', | ||
showCancel: false, | ||
success: function (res) { | ||
if (res.confirm) { | ||
console.log('用户点击确定') | ||
} | ||
} | ||
showCancel: false | ||
}) | ||
} | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,7 @@ | ||
// pages/settings/clause/clause.js | ||
Page({ | ||
data:{}, | ||
onLoad:function(options){ | ||
data: {}, | ||
onLoad: options => { | ||
// 页面初始化 options为页面跳转所带来的参数 | ||
}, | ||
onReady:function(){ | ||
// 页面渲染完成 | ||
}, | ||
onShow:function(){ | ||
// 页面显示 | ||
}, | ||
onHide:function(){ | ||
// 页面隐藏 | ||
}, | ||
onUnload:function(){ | ||
// 页面关闭 | ||
} | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,7 @@ | ||
// pages/settings/help/help.js | ||
Page({ | ||
data:{}, | ||
onLoad:function(options){ | ||
data: {}, | ||
onLoad: options => { | ||
// 页面初始化 options为页面跳转所带来的参数 | ||
}, | ||
onReady:function(){ | ||
// 页面渲染完成 | ||
}, | ||
onShow:function(){ | ||
// 页面显示 | ||
}, | ||
onHide:function(){ | ||
// 页面隐藏 | ||
}, | ||
onUnload:function(){ | ||
// 页面关闭 | ||
} | ||
}) | ||
}) |
Oops, something went wrong.