generated from sonofmagic/npm-lib-template
-
-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: add `cssRemoveHoverPseudoClass` option * refactor: getOptions * refactor: getOptions * chore: prepare for release * chore: format code * chore: init native mp * chore(deps): add default include
- Loading branch information
1 parent
3d7ba6f
commit 9bfe372
Showing
112 changed files
with
2,758 additions
and
244 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
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 |
---|---|---|
|
@@ -5,5 +5,5 @@ | |
"singleQuote": true, | ||
"endOfLine": "lf", | ||
"trailingComma": "none", | ||
"printWidth": 180 | ||
"printWidth": 120 | ||
} |
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
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,74 @@ | ||
// app.js | ||
App({ | ||
onLaunch() { | ||
onLaunch: function () { | ||
// 展示本地存储能力 | ||
const logs = wx.getStorageSync('logs') || [] | ||
logs.unshift(Date.now()) | ||
wx.setStorageSync('logs', logs) | ||
|
||
// 登录 | ||
wx.login({ | ||
success: res => { | ||
// 发送 res.code 到后台换取 openId, sessionKey, unionId | ||
success: (res) => {} | ||
}) | ||
// 获取用户信息 | ||
wx.getSetting({ | ||
success: (res) => { | ||
if (res.authSetting['scope.userInfo']) { | ||
// 已经授权,可以直接调用 getUserInfo 获取头像昵称,不会弹框 | ||
wx.getUserInfo({ | ||
success: (res) => { | ||
// 可以将 res 发送给后台解码出 unionId | ||
this.globalData.userInfo = res.userInfo | ||
console.log(res.userInfo) | ||
// 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回 | ||
// 所以此处加入 callback 以防止这种情况 | ||
if (this.userInfoReadyCallback) { | ||
this.userInfoReadyCallback(res) | ||
} | ||
} | ||
}) | ||
} | ||
} | ||
}) | ||
}, | ||
http: function (url, data = '', method = 'GET') { | ||
// 封装http请求 | ||
const apiUrl = 'https://wx.yogalt.com/api/' // 请求域名 | ||
console.log(this.globalData) | ||
const currency = { | ||
openid: this.globalData.openid | ||
} | ||
return new Promise((resolve, reject) => { | ||
wx.request({ | ||
url: apiUrl + url, | ||
data: Object.assign(currency, data), | ||
method, | ||
success: function (res) { | ||
if (res.data.code != 200) { | ||
wx.showModal({ | ||
title: '提示', | ||
content: res.data.message, | ||
success: function (res) { | ||
if (res.confirm) { | ||
console.log('用户点击确定') | ||
} else if (res.cancel) { | ||
console.log('用户点击取消') | ||
} | ||
} | ||
}) | ||
} | ||
resolve(res.data) | ||
}, | ||
fail: function (res) { | ||
reject(res) | ||
}, | ||
complete: function () { | ||
console.log('complete') | ||
} | ||
}) | ||
}) | ||
}, | ||
globalData: { | ||
userInfo: null | ||
userInfo: null, | ||
openid: 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,47 @@ | ||
{ | ||
"pages": [ | ||
"pages/index/index", | ||
"pages/logs/logs" | ||
"pages/list/index", | ||
"pages/cart/index", | ||
"pages/user/index", | ||
"pages/details/index", | ||
"pages/bindPhone/index", | ||
"pages/coupon/index", | ||
"pages/order/index", | ||
"pages/addressList/index", | ||
"pages/addressAdd/index", | ||
"pages/orderDetails/index" | ||
], | ||
"window": { | ||
"navigationBarTextStyle": "black", | ||
"navigationBarTitleText": "Weixin", | ||
"navigationBarBackgroundColor": "#ffffff" | ||
"backgroundTextStyle": "light", | ||
"navigationBarBackgroundColor": "#fff", | ||
"navigationBarTitleText": "WeChat", | ||
"navigationBarTextStyle": "black" | ||
}, | ||
"style": "v2", | ||
"componentFramework": "glass-easel", | ||
"sitemapLocation": "sitemap.json", | ||
"lazyCodeLoading": "requiredComponents" | ||
} | ||
"tabBar": { | ||
"backgroundColor": "#fff", | ||
"borderStyle": "black", | ||
"color": "#333", | ||
"selectedColor": "#ff5f19", | ||
"list": [ | ||
{ | ||
"selectedIconPath": "images/home_page_n.png", | ||
"iconPath": "images/home_page_y.png", | ||
"pagePath": "pages/index/index", | ||
"text": "首页" | ||
}, | ||
{ | ||
"selectedIconPath": "images/Shopping.png", | ||
"iconPath": "images/shopping_select.png", | ||
"pagePath": "pages/cart/index", | ||
"text": "购物车" | ||
}, | ||
{ | ||
"selectedIconPath": "images/my_y.png", | ||
"iconPath": "images/my_n.png", | ||
"pagePath": "pages/user/index", | ||
"text": "我的" | ||
} | ||
] | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
@@ -0,0 +1,89 @@ | ||
// pages/addressAdd/index.js | ||
const app = getApp() | ||
Page({ | ||
/** | ||
* 页面的初始数据 | ||
*/ | ||
data: { | ||
region: ['广东省', '广州市', '海珠区'], | ||
customItem: '全部', | ||
name: '', | ||
mobile: '', | ||
detailed: '', | ||
addressIs: true, | ||
_id: null | ||
}, | ||
bindRegionChange: function (e) { | ||
console.log('picker发送选择改变,携带值为', e.detail.value) | ||
console.log(e.detail.value) | ||
this.setData({ | ||
region: e.detail.value | ||
}) | ||
}, | ||
bindKeyName: function (e) { | ||
this.setData({ | ||
name: e.detail.value | ||
}) | ||
}, | ||
bindKeyMobile: function (e) { | ||
this.setData({ | ||
mobile: e.detail.value | ||
}) | ||
}, | ||
bindKeyDetailed: function (e) { | ||
this.setData({ | ||
detailed: e.detail.value | ||
}) | ||
}, | ||
submitFun: function () {}, | ||
/** | ||
* 生命周期函数--监听页面加载 | ||
*/ | ||
onLoad: function (options) { | ||
if (options.id) { | ||
this.setData({ | ||
region: options.city.split(','), | ||
name: options.name, | ||
mobile: options.mobile, | ||
detailed: options.detailed, | ||
_id: options.id, | ||
addressIs: false | ||
}) | ||
} | ||
}, | ||
|
||
/** | ||
* 生命周期函数--监听页面初次渲染完成 | ||
*/ | ||
onReady: function () {}, | ||
|
||
/** | ||
* 生命周期函数--监听页面显示 | ||
*/ | ||
onShow: function () {}, | ||
|
||
/** | ||
* 生命周期函数--监听页面隐藏 | ||
*/ | ||
onHide: function () {}, | ||
|
||
/** | ||
* 生命周期函数--监听页面卸载 | ||
*/ | ||
onUnload: function () {}, | ||
|
||
/** | ||
* 页面相关事件处理函数--监听用户下拉动作 | ||
*/ | ||
onPullDownRefresh: function () {}, | ||
|
||
/** | ||
* 页面上拉触底事件的处理函数 | ||
*/ | ||
onReachBottom: function () {}, | ||
|
||
/** | ||
* 用户点击右上角分享 | ||
*/ | ||
onShareAppMessage: 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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"navigationBarTitleText": "新增地址" | ||
} |
Oops, something went wrong.