Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
WARJY committed Jul 23, 2018
0 parents commit 8f37859
Show file tree
Hide file tree
Showing 215 changed files with 12,029 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# cue
40 changes: 40 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
//app.js
App({
onLaunch: function () {
// 展示本地存储能力
var logs = wx.getStorageSync('logs') || []
logs.unshift(Date.now())
wx.setStorageSync('logs', logs)

// 登录
wx.login({
success: res => {
// 发送 res.code 到后台换取 openId, sessionKey, unionId
}
})
// 获取用户信息
wx.getSetting({
success: res => {
if (res.authSetting['scope.userInfo']) {
// 已经授权,可以直接调用 getUserInfo 获取头像昵称,不会弹框
wx.getUserInfo({
success: res => {
// 可以将 res 发送给后台解码出 unionId
this.globalData.userInfo = res.userInfo

// 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
// 所以此处加入 callback 以防止这种情况
if (this.userInfoReadyCallback) {
this.userInfoReadyCallback(res)
}
}
})
}
}
})
},
globalData: {
userInfo: null
},
color:"#00d2ff"
})
44 changes: 44 additions & 0 deletions app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"pages":[
"demo/index/index",
"demo/page/page",
"demo/input/input",
"demo/form/form",
"demo/accountPanel/accountPanel",
"cue/Page/Page",
"cue/List/List",
"cue/ButtonPanel/ButtonPanel",
"cue/Panel/Panel",
"cue/Panel2/Panel2",
"cue/BuyPanel/BuyPanel",
"cue/PlayPanel/PlayPanel",
"cue/ImageBanner/ImageBanner",
"cue/HtmlPanel/HtmlPanel",
"cue/TabNav/TabNav",
"cue/Table/Table",
"cue/Button/Button",
"cue/CardPanel/CardPanel",
"cue/AccountPanel/AccountPanel",
"cue/Input/Input",
"cue/Search/Search",
"cue/MT_City/MT_City",
"cue/Form/Form",
"cue/Grid/Grid",
"cue/ImageList/ImageList",
"cue/MaskPanel/MaskPanel",
"cue/ScrollPanel/ScrollPanel",
"cue/SearchPanel/SearchPanel",
"cue/TabPanel/TabPanel",
"cue/inputModal/inputModal",
"cue/DetailPanel/ProductDetailPanel/ProductDetailPanel",
"cue/DetailPanel/NewsDetail/NewsDetail",
"cue/DetailPanel/DetailPanel",
"cue/Examine/Examine"
],
"window":{
"backgroundTextStyle":"light",
"navigationBarBackgroundColor": "#fff",
"navigationBarTitleText": "WeChat",
"navigationBarTextStyle":"black"
}
}
4 changes: 4 additions & 0 deletions app.wxss
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/**app.wxss**/
view{
font-family: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif
}
89 changes: 89 additions & 0 deletions cue/AccountPanel/AccountPanel.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
let app = getApp()

Component({
/**
* 组件的属性列表
*/
properties: {
logoUrl:{
type:String,
value:""
},
showLogin: {
type: Boolean,
value:false
},
logType:{
type:Array,
value:[]
},
wxLog:{
type:String,
value:""
}
},

/**
* 组件的初始数据
*/
data: {
showInfo: true
},

/**
* 组件的方法列表
*/
ready() {
let UserInfo = wx.getStorageSync("UserInfo")
let color = app.color
if (UserInfo && UserInfo.nickName && UserInfo.avatarUrl) {
this.setData({
showInfo: false,
showLogin:false,
color: color
})
} else {
this.setData({
showInfo: true,
color: color
})
}
},

methods: {
_close: function(e) {
this.setData({
showLogin: false
});
},
_getPhoneNumber: function(e) {
this.triggerEvent("wxLog",e)
},
_getUserInfo: function(e) {
if (e.detail.userInfo) {
console.log(e.detail.userInfo)
wx.setStorage({
key: 'UserInfo',
data: e.detail.userInfo,
})
}
if (this.properties.wxLog || this.properties.logType.length > 0){
this.setData({
showInfo: false
})
}else{
this.setData({
showLogin:false
})
this.triggerEvent("userInfo", e.detail.userInfo)
}
},
_handleLink:function(e){
let link = e.currentTarget.dataset.item.link
if(!link) return
wx.navigateTo({
url: link,
})
}
}
})
4 changes: 4 additions & 0 deletions cue/AccountPanel/AccountPanel.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"component": true,
"usingComponents": {}
}
24 changes: 24 additions & 0 deletions cue/AccountPanel/AccountPanel.wxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<view wx:if='{{showLogin === true}}'>
<view class='mask' bindtap='_close'></view>
<view class='log-type' style='' wx:if="{{!showInfo}}">
<view class='btn-close' bindtap='_close'>×</view>
<view class='title'>请选择登录/注册方式</view>
<button wx:if="{{wxLog}}" class="btn log" style='background-color:{{color}};color:#fff' open-type='getPhoneNumber' bindgetphonenumber='_getPhoneNumber'>
<image class='icon' src='wx-white.png'></image>
<view class='text'>{{wxLog}}</view>
</button>
<button wx:for="{{logType}}" class="btn log" wx:key="{{index}}" data-item="{{item}}" bindtap='_handleLink'>
<image class='icon' src='{{item.icon}}'></image>
<view class='text'>{{item.text}}</view>
</button>
</view>
<view class='login-panel' wx:if="{{showInfo}}">
<view>
<image src='{{logoUrl}}' class='logo'></image>
<button class="btn log" style='background-color:{{color}};color:#fff' open-type='getUserInfo' bindgetuserinfo='_getUserInfo'>
<image class='icon' src='wx-white.png'></image>
<view class='text'>获取微信授权</view>
</button>
</view>
</view>
</view>
107 changes: 107 additions & 0 deletions cue/AccountPanel/AccountPanel.wxss
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
.full {
width: 100%;
height: 100vh;
}

.flex {
display: flex;
justify-content: center;
align-items: center;
}

.mask {
width: 100%;
height: 100vh;
background-color: #000;
opacity: 0.2;
position: fixed;
top: 0;
left: 0;
z-index: 20;
}

.title {
font-size: 36rpx;
font-weight: bold;
text-align: center;
margin-bottom: 20px;
}

.log-type {
width: 500rpx;
background-color: #fff;
padding: 60rpx 40rpx 40rpx 40rpx;
border-radius: 4rpx;
box-shadow: 0 0 10rpx #ddd;
z-index: 30;
overflow: hidden;
position: fixed;
top: 50%;
left: 0;
background: #f9f9f9;
margin: -180rpx 105rpx;
}

.btn-close {
position: absolute;
font-size: 40rpx;
top: 10rpx;
right: 20rpx;
color: #999;
}

.type-btn {
padding: 20rpx;
background-color: #00ae66;
border-radius: 10rpx;
color: #fff;
text-align: center;
font-size: 30rpx;
margin: 20rpx;
}

.login-panel {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: #fff;
z-index: 21;
display: flex;
justify-content: center;
align-items: center;
}

.login-panel .logo {
width: 200rpx;
height: 200rpx;
margin: 0 auto;
display: block;
margin-bottom: 40rpx
}

.btn.log{
display: flex;
justify-content: center;
align-items: center;
padding: 10rpx 40rpx;
border-radius: 10rpx;
background-color: #f7f7f7;
margin-top: 20rpx
}

.bg-green{
background-color: #31c27c !important;
color:#fff;
}

.btn.log .icon{
width: 40rpx;
height: 40rpx;
}

.btn.log .text{
flex: 1;
margin-left: 20rpx;
}
Binary file added cue/AccountPanel/wx-white.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
58 changes: 58 additions & 0 deletions cue/BtnPanel/BtnPanel.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
// Matrix_Wx/BtnPanel/BtnPanel.js
const themes = {
default: {
className: "btn-default",
},
Bottom: {
className: "btn-bottom"
},
BottomGroup: {
className: "btn-bottom-group"
},
}
Component({
/**
* 组件的属性列表
*/
properties: {

isshow: {
type: Boolean,
value: true
},
theme: {
type: String,
value: "default"
}

},

/**
* 组件的初始数据
*/
data: {
currentTheme: {}
},

/**
* 组件的方法列表
*/
methods: {

},
ready() {
let defaultTheme = themes.default;
let currentTheme = themes[this.properties.theme];
let theme = {};
for (let p in defaultTheme) {
if (defaultTheme.hasOwnProperty(p)) {
if (currentTheme.hasOwnProperty(p)) {
theme[p] = currentTheme[p];
} else {
theme[p] = defaultTheme[p];
}
}
}
this.setData({ currentTheme: theme });
}
})
6 changes: 6 additions & 0 deletions cue/BtnPanel/BtnPanel.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"component": true,
"usingComponents": {

}
}
Loading

0 comments on commit 8f37859

Please sign in to comment.