/*!
* Bmob WeChat applet SDK
* http://www.bmob.cn
* Copyright Bmob, Inc.
* The Bmob WeChat applet SDK is freely distributable under the MIT license.
* (c) 2016-2050 Magic
*/
(function (root) {
var _ = require('underscore.js');
var Bmob = {};
Bmob.VERSION = "js0.0.1";
Bmob._ = _;
var EmptyConstructor = function () { };
if (typeof exports !== 'undefined') {
if (typeof module !== 'undefined' && module.exports) {
exports = module.exports = Bmob;
}
exports.Bmob = Bmob;
} else {
root.Bmob = Bmob;
}
// Helper function to correctly set up the prototype chain, for subclasses.
// Similar to `goog.inherits`, but uses a hash of prototype properties and
// class properties to be extended.
var inherits = function (parent, protoProps, staticProps) {
var child;
// The constructor function for the new subclass is either defined by you
// (the "constructor" property in your `extend` definition), or defaulted
// by us to simply call the parent's constructor.
if (protoProps && protoProps.hasOwnProperty('constructor')) {
child = protoProps.constructor;
} else {
/** @ignore */
child = function () {
parent.apply(this, arguments);
};
}
// Inherit class (static) properties from parent.
Bmob._.extend(child, parent);
// Set the prototype chain to inherit from `parent`, without calling
// `parent`'s constructor function.
EmptyConstructor.prototype = parent.prototype;
child.prototype = new EmptyConstructor();
// Add prototype properties (instance properties) to the subclass,
// if supplied.
if (protoProps) {
Bmob._.extend(child.prototype, protoProps);
}
// Add static properties to the constructor function, if supplied.
if (staticProps) {
Bmob._.extend(child, staticProps);
}
// Correctly set child's `prototype.constructor`.
child.prototype.constructor = child;
// Set a convenience property in case the parent's prototype is
// needed later.
child.__super__ = parent.prototype;
return child;
};
// Set the server for Bmob to talk to.
Bmob.serverURL = "https://api.bmob.cn";
Bmob.fileURL = "http://file.bmob.cn";
// Check whether we are running in Node.js.
if (typeof (process) !== "undefined" && process.versions && process.versions.node) {
Bmob._isNode = true;
}
/**
* 初始化时需要调用这个函数。可以从bmob中获取所需的key
*
* @param {String} applicationId 你的 Application ID.
* @param {String} applicationKey 你的 restful api Key.
* @param {String} masterKey (optional) 你的 bmob Master Key.
*/
Bmob.initialize = function (applicationId, applicationKey, masterKey) {
Bmob._initialize(applicationId, applicationKey, masterKey);
};
/**
* Call this method first to set up authentication tokens for Bmob.
* This method is for Bmob's own private use.
* @param {String} applicationId Your Bmob Application ID.
* @param {String} applicationKey Your Bmob Application Key
*/
Bmob._initialize = function (applicationId, applicationKey, masterKey) {
Bmob.applicationId = applicationId;
Bmob.applicationKey = applicationKey;
Bmob.masterKey = masterKey;
Bmob._useMasterKey = true;
Bmob.serverURL = "https://" + applicationId + ".bmobcloud.com";
};
if (Bmob._isNode) {
Bmob.initialize = Bmob._initialize;
}
/**
* Returns prefix for localStorage keys used by this instance of Bmob.
* @param {String} path The relative suffix to append to it.
* null or undefined is treated as the empty string.
* @return {String} The full key name.
*/
Bmob._getBmobPath = function (path) {
if (!Bmob.applicationId) {
throw "You need to call Bmob.initialize before using Bmob.";
}
if (!path) {
path = "";
}
if (!Bmob._.isString(path)) {
throw "Tried to get a localStorage path that wasn't a String.";
}
if (path[0] === "/") {
path = path.substring(1);
}
return "Bmob/" + Bmob.applicationId + "/" + path;
};
/**
* Returns prefix for localStorage keys used by this instance of Bmob.
* @param {String} path The relative suffix to append to it.
* null or undefined is treated as the empty string.
* @return {String} The full key name.
*/
Bmob._getBmobPath = function (path) {
if (!Bmob.applicationId) {
throw "You need to call Bmob.initialize before using Bmob.";
}
if (!path) {
path = "";
}
if (!Bmob._.isString(path)) {
throw "Tried to get a localStorage path that wasn't a String.";
}
if (path[0] === "/") {
path = path.substring(1);
}
return "Bmob/" + Bmob.applicationId + "/" + path;
};
/**
* Returns the unique string for this app on this machine.
* Gets reset when localStorage is cleared.
*/
Bmob._installationId = null;
Bmob._getInstallationId = function () {
// See if it's cached in RAM.
if (Bmob._installationId) {
return Bmob._installationId;
}
// Try to get it from localStorage.
var path = Bmob._getBmobPath("installationId");
// Bmob._installationId = Bmob.localStorage.getItem(path);
wx.getStorage({
key: 'key',
success: function (res) {
Bmob._installationId = res.data;
console.log(res.data)
}
})
if (!Bmob._installationId || Bmob._installationId === "") {
// It wasn't in localStorage, so create a new one.
var hexOctet = function () {
return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1);
};
Bmob._installationId = (hexOctet() + hexOctet() + "-" + hexOctet() + "-" + hexOctet() + "-" + hexOctet() + "-" + hexOctet() + hexOctet() + hexOctet());
wx.setStorage({
key: path,
data: Bmob._installationId
})
}
return Bmob._installationId;
};
Bmob._parseDate = function (iso8601) {
var regexp = new RegExp("^([0-9]{1,4})-([0-9]{1,2})-([0-9]{1,2})" + "T" + "([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})" + "(.([0-9]+))?" + "Z$");
var match = regexp.exec(iso8601);
if (!match) {
return null;
}
var year = match[1] || 0;
var month = (match[2] || 1) - 1;
var day = match[3] || 0;
var hour = match[4] || 0;
var minute = match[5] || 0;
var second = match[6] || 0;
var milli = match[8] || 0;
return new Date(Date.UTC(year, month, day, hour, minute, second, milli));
};
Bmob._ajax = function (method, url, data, success, error) {
var options = {
success: success,
error: error
};
var promise = new Bmob.Promise();
var dataObject = JSON.parse(data);
var error;
wx.showNavigationBarLoading()
if (dataObject.category == "wechatApp") {
wx.uploadFile({
url: url,
filePath: dataObject.base64,
name: 'file',
header: {
"X-Bmob-SDK-Type": "wechatApp"
},
formData: dataObject,
success: function (res) {
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
小程序开发 系统设计 可用于毕业设计、课程设计、项目实践,提供设计资料+源码 小程序开发 系统设计 可用于毕业设计、课程设计、项目实践,提供设计资料+源码 小程序开发 系统设计 可用于毕业设计、课程设计、项目实践,提供设计资料+源码 小程序开发 系统设计 可用于毕业设计、课程设计、项目实践,提供设计资料+源码 小程序开发 系统设计 可用于毕业设计、课程设计、项目实践,提供设计资料+源码 小程序开发 系统设计 可用于毕业设计、课程设计、项目实践,提供设计资料+源码 小程序开发 系统设计 可用于毕业设计、课程设计、项目实践,提供设计资料+源码 小程序开发 系统设计 可用于毕业设计、课程设计、项目实践,提供设计资料+源码 小程序开发 系统设计 可用于毕业设计、课程设计、项目实践,提供设计资料+源码 小程序开发 系统设计 可用于毕业设计、课程设计、项目实践,提供设计资料+源码 小程序开发 系统设计 可用于毕业设计、课程设计、项目实践,提供设计资料+源码 小程序开发 系统设计 可用于毕业设计、课程设计、项目实践,提供设计资料+源码 小程序开发 系统设计 可用于毕业设计、课程设计、项目实践,提供设计资料+源码 小程序开发 系统设计 可用于毕业设计、课程设计、项目实践,提供设计资料+源码 小程序开发 系统设计 可用于毕业设计、课程设计、项目实践,提供设计资料+源码 小程序开发 系统设计 可用于毕业设计、课程设计、项目实践,提供设计资料+源码 小程序开发 系统设计 可用于毕业设计、课程设计、项目实践,提供设计资料+源码 小程序开发 系统设计 可用于毕业设计、课程设计、项目实践,提供设计资料+源码
资源推荐
资源详情
资源评论
收起资源包目录
微信小程序毕业设计 餐厅点餐 登录.zip (86个子文件)
graduation-project-main
sitemap.json 191B
pages
indent
indent.json 27B
indent.wxss 30B
indent.js 845B
indent.wxml 70B
use
use.json 27B
use.wxss 482B
use.wxml 358B
use.js 839B
store
store.js 23KB
store.wxss 6KB
store.json 117B
store.wxml 6KB
addressList
addressList.json 48B
addressList.js 975B
addressList.wxml 684B
addressList.wxss 915B
index
index.wxml 2KB
index.js 855B
index.json 27B
index.wxss 3KB
rules
rules.wxml 5KB
rules.js 843B
rules.json 27B
rules.wxss 353B
order
order.wxml 2KB
order.json 27B
order.js 1KB
order.wxss 4KB
comments
comments.wxss 673B
comments.json 27B
comments.js 1KB
comments.wxml 2KB
information
information.js 7KB
information.wxml 4KB
information.json 27B
information.wxss 1KB
logs
logs.json 77B
logs.js 855B
logs.wxml 0B
logs.wxss 0B
agreement
agreement.wxml 5KB
agreement.js 851B
agreement.wxss 353B
agreement.json 27B
advice
advice.js 1KB
advice.json 27B
advice.wxss 523B
advice.wxml 223B
login
login.js 7KB
login.json 27B
login.wxml 691B
login.wxss 1KB
indexin
indexin.wxss 762B
indexin.json 27B
indexin.js 1KB
indexin.wxml 978B
app.json 747B
project.config.json 1KB
app.js 31B
image
Zheng.png 18KB
decrease_1@2x.png 2KB
bulletin@2x.png 2KB
包.png 2KB
brand@2x.png 2KB
粑粑人头像.jpg 10KB
gouwuche-black.png 4KB
NTF.jpg 78KB
书.png 2KB
关于.png 2KB
ding-ico1.png 2KB
圆点.png 525B
gouwuche.png 4KB
地址.png 2KB
下拉箭头.png 344B
购物车.png 449B
上箭头.png 344B
utils
qqmap-wx-jssdk.min.js 6KB
underscore.js 59KB
menus.js 3KB
utlis.js 374B
bmob.js 264KB
WxNotificationCenter.js 5KB
util.js 426B
init.js 119B
app.wxss 0B
共 86 条
- 1
资源评论
辣椒种子
- 粉丝: 3442
- 资源: 5724
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功