对接接口

This commit is contained in:
2020-05-25 22:03:54 +08:00
parent 64872b2e78
commit dbc607f67d
3 changed files with 140 additions and 35 deletions

View File

@ -1,21 +1,17 @@
mui.plusReady(function(){
// some ajax
$(".footer").on("tap", ()=>{
app.create()
$(".footer").click(function(){
app.create();
})
})
const app = new Vue({
el: '#app',
data() {
return {
noteData: [
],
counter: 0
}
},
created() {
console.log("Vue")
},
methods: {
triggerDelete(index) {
this.$set(this.noteData[index], 'currentDelete', true)
@ -30,28 +26,49 @@ const app = new Vue({
window.location.reload()
},
edit(index){
console.log("编辑", this.noteData[index])
// some ajax
mui.toast("编辑")
window.location.reload()
mui.openWindow({
url: "notepad_edit.html",
id: "notepad_edit"+index,
extras: {
noteId: index
},
createNew: false, //是否重复创建同样id的webview默认为false:不重复创建,直接显示
waiting: {
autoShow: true, //自动显示等待框默认为true
title: '正在加载...', //等待对话框上显示的提示内容
}
})
},
create(){
// some jump
if(this.counter < 10){
mui.toast("跳转")
this.counter ++ ;
}else{
mui.toast("开发中")
this.counter = 0;
JZL.openWindow('trade_rule.html', 'trade_rule.html')
}
this.edit(0);
// JZL.openWindow('trade_rule.html', 'trade_rule.html')
},
loadData() {
$.ajax({
url: qlgUrl("app/note/index"),
method: "GET",
dataType: 'json',
success: function(res){
if(res.status == 1){
this.noteData = res.data;
localStorage.setItem("LOCAL_NOTE", JSON.stringify(res.data));
}else{
mui.alert(res.msg);
}
},
error: function(err){
mui.alert("请求失败");
self.back();
}
});
},
},
created() {
var localData = localStorage.getItem("LOCAL_NOTE");
this.loadData();
if(localData){
this.noteData = JSON.parse(localData);
}
},
mounted() {
// some ajax
this.noteData = [
{id: 1, name: '功能正在开发中', created_at: "2019-09-09 18:00:01", updated_at: "2019-09-09 18:09:09"},
{id: 2, name: '只是一个DEMO页', created_at: "2019-09-09 19:00:01", updated_at: "2019-09-09 20:09:09"},
]
}
})