This commit is contained in:
Saturneric 2020-09-01 00:55:41 +08:00
parent 0748b14a9e
commit 73fc37e472
324 changed files with 18246 additions and 0 deletions

2
.eslintignore Normal file
View File

@ -0,0 +1,2 @@
/vendor
/node_modules

99
.eslintrc.js Normal file
View File

@ -0,0 +1,99 @@
module.exports = {
'extends': [
'airbnb-base',
'plugin:promise/recommended'
],
'parserOptions': {
'ecmaVersion': 9,
'ecmaFeatures': {
'jsx': false
},
'sourceType': 'module'
},
'env': {
'es6': true,
'node': true,
'jest': true
},
'plugins': [
'import',
'node',
'promise'
],
'rules': {
'arrow-parens': 'off',
'comma-dangle': [
'error',
'only-multiline'
],
'complexity': ['error', 10],
'func-names': 'off',
'global-require': 'off',
'handle-callback-err': [
'error',
'^(err|error)$'
],
'import/no-unresolved': [
'error',
{
'caseSensitive': true,
'commonjs': true,
'ignore': ['^[^.]']
}
],
'import/prefer-default-export': 'off',
'linebreak-style': 'off',
'no-catch-shadow': 'error',
'no-continue': 'off',
'no-div-regex': 'warn',
'no-else-return': 'off',
'no-param-reassign': 'off',
'no-plusplus': 'off',
'no-shadow': 'off',
// enable console for this project
'no-console': 'off',
'no-multi-assign': 'off',
'no-underscore-dangle': 'off',
'node/no-deprecated-api': 'error',
'node/process-exit-as-throw': 'error',
'object-curly-spacing': [
'error',
'never'
],
'operator-linebreak': [
'error',
'after',
{
'overrides': {
':': 'before',
'?': 'before'
}
}
],
'prefer-arrow-callback': 'off',
'prefer-destructuring': 'off',
'prefer-template': 'off',
'quote-props': [
1,
'as-needed',
{
'unnecessary': true
}
],
'semi': [
'error',
'never'
]
},
'globals': {
'window': true,
'document': true,
'App': true,
'Page': true,
'Component': true,
'Behavior': true,
'wx': true,
'worker': true,
'getApp': true
}
}

11
.gitignore vendored Normal file
View File

@ -0,0 +1,11 @@
*swp
.idea
.DS_Store
package-lock.json
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
node_modules

21
LICENSE Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2018 wechat-miniprogram
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

28
README.md Normal file
View File

@ -0,0 +1,28 @@
# 微信小程序示例
微信小程序示例源码,欢迎扫描以下小程序码体验。
> 提示:请使用微信开发者工具或微信客户端 6.7.2 及以上版本运行。
<img width="200" src="https://developers.weixin.qq.com/miniprogram/dev/image/demo.jpg">
## 使用
使用[微信开发者工具](https://developers.weixin.qq.com/miniprogram/dev/devtools/download.html)打开该示例代码,云开发环境搭建请参考[云开发示例说明](https://github.com/wechat-miniprogram/miniprogram-demo/blob/master/miniprogram/page/cloud/README.md)。
## 贡献
如果你有 bug 反馈或其他任何建议,欢迎提 issue 给我们。
如果你愿意一起来完善小程序示例,欢迎通过 PR 的方式贡献代码。为了保证代码风格的统一,在编写代码之前,请在项目根目录运行以下命令安装依赖:
```
npm install
```
同时,确保你的代码可以通过 Lint 检查:
```
npm run lint
```
## 截图
![截图](https://developers.weixin.qq.com/miniprogram/dev/image/demo.png)

View File

@ -0,0 +1,13 @@
// 云函数入口文件
const cloud = require('wx-server-sdk')
// 云函数入口函数
exports.main = async () => {
cloud.init({
env: process.env.TCB_ENV,
})
const db = cloud.database()
return db.collection('perm4').where({
_openid: 'server'
}).limit(1).get()
}

View File

@ -0,0 +1,14 @@
{
"name": "getServerDataDemo",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"wx-server-sdk": "latest"
}
}

View File

@ -0,0 +1,14 @@
// 云函数入口文件
const cloud = require('wx-server-sdk')
// 云函数入口函数
exports.main = async (event) => {
cloud.init({
env: process.env.TCB_ENV,
})
const fileList = event.fileIdList
const result = await cloud.getTempFileURL({
fileList,
})
return result.fileList
}

View File

@ -0,0 +1,14 @@
{
"name": "getTempFileURL",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"wx-server-sdk": "latest"
}
}

View File

@ -0,0 +1,13 @@
{
"permissions": {
"openapi": [
"wxacode.getUnlimited",
"templateMessage.send",
"templateMessage.addTemplate",
"templateMessage.deleteTemplate",
"templateMessage.getTemplateList",
"templateMessage.getTemplateLibraryById",
"templateMessage.getTemplateLibraryList"
]
}
}

View File

@ -0,0 +1,65 @@
// 云函数入口文件
const cloud = require('wx-server-sdk')
cloud.init({env : "asr-v3kua"})
async function sendTemplateMessage(event) {
const {OPENID} = cloud.getWXContext()
// 接下来将新增模板、发送模板消息、然后删除模板
// 注意:新增模板然后再删除并不是建议的做法,此处只是为了演示,模板 ID 应在添加后保存起来后续使用
const addResult = await cloud.openapi.templateMessage.addTemplate({
id: 'AT0002',
keywordIdList: [3, 4, 5]
})
const templateId = addResult.result.templateId
const sendResult = await cloud.openapi.templateMessage.send({
touser: OPENID,
templateId,
formId: event.formId,
page: 'page/cloud/pages/scf-openapi/scf-openapi',
data: {
keyword1: {
value: '未名咖啡屋',
},
keyword2: {
value: '2019 年 1 月 1 日',
},
keyword3: {
value: '拿铁',
},
}
})
await cloud.openapi.templateMessage.deleteTemplate({
templateId,
})
return sendResult
}
async function getWXACode() {
const {result} = await cloud.openapi.wxacode.getUnlimited({
scene: 'x=1',
})
// 此处返回 Base64 图片仅作为演示用,在实际开发中,
// 应上传图片至云文件存储,然后在小程序中通过云文件 ID 使用
return `data:${result.contentType};base64,${result.buffer.toString('base64')}`
}
// 云函数入口函数
// eslint-disable-next-line
exports.main = async (event) => {
switch (event.action) {
case 'sendTemplateMessage': {
return sendTemplateMessage(event)
}
case 'getWXACode': {
return getWXACode(event)
}
default: break
}
}

View File

@ -0,0 +1,14 @@
{
"name": "openapi",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"wx-server-sdk": "latest"
}
}

View File

@ -0,0 +1,15 @@
// 云函数入口文件
const cloud = require('wx-server-sdk')
cloud.init({env: "asr-v3kua"})
// 云函数入口函数
exports.main = async () => {
const wxContext = cloud.getWXContext()
return {
openid: wxContext.OPENID,
appid: wxContext.APPID,
unionid: wxContext.UNIONID,
}
}

View File

@ -0,0 +1,14 @@
{
"name": "wxContext",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"wx-server-sdk": "latest"
}
}

0
git.codesdream.com.txt Normal file
View File

87
miniprogram/app.js Normal file
View File

@ -0,0 +1,87 @@
//app.js
var config = require('./config')
var auth = require('./utils/auth')
App({
globalData:{
token : null,
openid : null,
clientCode : '965cda1983f569b03abfb80dc9af8dd8',
hh:"\n",
loading: true,
registerListens: [],
},
onLaunch: function () {
this.login();
},
// 认证访问
authRequest: function(object){
var that = this;
var authObj = auth.authCodeGenerator;
authObj.updateTimestamp();
wx.request({
url: object.url,
header:{
'openid': that.globalData.openid,
'X-Requested-With': '',
'timestamp': authObj.timestamp,
'signed': authObj.signed(that.globalData.openid, that.globalData.token)
},
data: object.data,
success: object.success,
fail:object.fail,
});
},
listenLoading:function(method){
if(this.globalData.loading == false) method();
else this.globalData.registerListens.push(method)
},
login: function(){
let that = this;
// 尝试登录
wx.login({
complete: (res) => {
console.log(res);
wx.request({
url: config.loginUrl,
method: "GET",
data: {
code : res.code
},
success: function(res){
// 设置SessionKey
that.globalData.token = res.data.token;
that.globalData.openid = res.data.openid;
console.log("success",that.globalData);
console.log("sdaa",res)
that.globalData.loading = false;
for (const f of that.globalData.registerListens){
f();
}
that.globalData.registerListens = []
/*
that.authRequest({
url : "https://compute.bktus.com",
success: function (res) {
console.log(res)
},
fail: function (res) {
console.log(res)
}
});*/
},
fail: function(res){
console.log(res)
}
})
}
});
}
})

59
miniprogram/app.json Normal file
View File

@ -0,0 +1,59 @@
{
"pages": [
"pages/index/index",
"pages/init/init",
"pages/databaseTest/databaseTest",
"pages/information/information",
"pages/information/about/about",
"pages/information/submit/submit",
"pages/list/list",
"pages/information/setting/setting",
"pages/information/graph/graph",
"pages/alloc/alloc",
"pages/information/help/help"
],
"useExtendedLib": {
"kbone": true,
"weui": true
},
"window": {
"backgroundColor": "#F6F6F6",
"backgroundTextStyle": "light",
"navigationBarBackgroundColor": "#F6F6F6",
"navigationBarTitleText": "\"措置有方\"",
"navigationBarTextStyle": "black"
},
"sitemapLocation": "sitemap.json",
"tabBar": {
"color": "#8a8a8a",
"selectedColor": "#7644df",
"borderStyle": "black",
"backgroundColor": "white",
"list": [
{
"pagePath": "pages/index/index",
"text": "近24小时",
"iconPath": "images/001.png",
"selectedIconPath": "images/001-2.png"
},
{
"pagePath": "pages/list/list",
"text": "要做的事情",
"iconPath": "images/002.png",
"selectedIconPath": "images/002-2.png"
},
{
"pagePath": "pages/alloc/alloc",
"text": "最优规划表",
"iconPath": "images/004-1.png",
"selectedIconPath": "images/004-2.png"
},
{
"pagePath": "pages/information/information",
"text": "关于我自己",
"iconPath": "images/003.png",
"selectedIconPath": "images/003-2.png"
}
]
}
}

33
miniprogram/app.wxss Normal file
View File

@ -0,0 +1,33 @@
/**app.wxss**/
.container {
display: flex;
flex-direction: column;
align-items: center;
box-sizing: border-box;
}
.btn,.sx,.ks{
color: #8538ff;
top: 30px;
width: 90px;
margin-left:auto;
margin-right:auto;
margin-bottom: 40px;
}
.ipt,.picker1,.ipt-2{
border-style: solid;
border-width: 4rpx;
margin-left: 20px;
height: 40px;
width: 80%;
margin-top:10px ;
border-radius: 15rpx;
margin-bottom: 15rpx;
border-color: #8538ff;
font-size: 40rpx;
text-align: center;
background-color: #ffffff;
text-align: left;
}

16
miniprogram/config.js Normal file
View File

@ -0,0 +1,16 @@
/**
* 小程序配置文件
*/
var host = "https://asr.codesdream.com";
// var host = "http://localhost:8087";
var appID = "wx8d9d87cf93f3e918";
var config = {
loginUrl: host+'/wx/user/'+appID+'/login',
hostUrl: host
};
module.exports = config;

47
miniprogram/dist/action-sheet/index.js vendored Normal file
View File

@ -0,0 +1,47 @@
Component({
externalClasses: ['i-class', 'i-class-mask', 'i-class-header'],
options: {
multipleSlots: true
},
properties: {
visible: {
type: Boolean,
value: false
},
maskClosable: {
type: Boolean,
value: true
},
showCancel: {
type: Boolean,
value: false
},
cancelText: {
type: String,
value: '取消'
},
actions: {
type: Array,
value: []
}
},
methods: {
handleClickMask () {
if (!this.data.maskClosable) return;
this.handleClickCancel();
},
handleClickItem ({ currentTarget = {} }) {
const dataset = currentTarget.dataset || {};
const { index } = dataset;
this.triggerEvent('click', { index });
},
handleClickCancel () {
this.triggerEvent('cancel');
}
}
});

View File

@ -0,0 +1,8 @@
{
"component": true,
"usingComponents":
{
"i-button": "../button/index",
"i-icon": "../icon/index"
}
}

View File

@ -0,0 +1,23 @@
<view class="i-as-mask i-class-mask {{ visible ? 'i-as-mask-show' : '' }}" bindtap="handleClickMask"></view>
<view class="i-class i-as {{ visible ? 'i-as-show' : '' }}">
<view class="i-as-header i-class-header"><slot name="header"></slot></view>
<view class="i-as-actions">
<view class="i-as-action-item" wx:for="{{ actions }}" wx:key="{{ item.name }}">
<i-button
bind:click="handleClickItem"
data-index="{{ index }}"
open-type="{{ item.openType }}"
type="ghost"
size="large"
long
>
<view class="i-as-btn-loading" wx:if="{{ item.loading }}"></view>
<i-icon wx:if="{{ item.icon }}" type="{{ item.icon }}" i-class="i-as-btn-icon"></i-icon>
<view class="i-as-btn-text" style="{{ item.color ? 'color: ' + item.color : '' }}">{{ item.name }}</view>
</i-button>
</view>
</view>
<view class="i-as-cancel" wx:if="{{ showCancel }}">
<i-button i-class="i-as-cancel-btn" type="ghost" size="large" long="true" bind:click="handleClickCancel">{{ cancelText }}</i-button>
</view>
</view>

View File

@ -0,0 +1 @@
.i-as{position:fixed;width:100%;box-sizing:border-box;left:0;right:0;bottom:0;background:#f7f7f7;transform:translate3d(0,100%,0);transform-origin:center;transition:all .2s ease-in-out;z-index:900;visibility:hidden}.i-as-show{transform:translate3d(0,0,0);visibility:visible}.i-as-mask{position:fixed;top:0;left:0;right:0;bottom:0;background:rgba(0,0,0,.7);z-index:900;transition:all .2s ease-in-out;opacity:0;visibility:hidden}.i-as-mask-show{opacity:1;visibility:visible}.i-as-action-item{position:relative}.i-as-action-item::after{content:'';position:absolute;top:0;left:0;width:200%;height:200%;transform:scale(.5);transform-origin:0 0;pointer-events:none;box-sizing:border-box;border:0 solid #e9eaec;border-bottom-width:1px}.i-as-header{background:#fff;text-align:center;position:relative;font-size:12px;color:#80848f}.i-as-header::after{content:'';position:absolute;top:0;left:0;width:200%;height:200%;transform:scale(.5);transform-origin:0 0;pointer-events:none;box-sizing:border-box;border:0 solid #e9eaec;border-bottom-width:1px}.i-as-cancel{margin-top:6px}.i-as-btn-loading{display:inline-block;vertical-align:middle;margin-right:10px;width:12px;height:12px;background:0 0;border-radius:50%;border:2px solid #e5e5e5;border-color:#666 #e5e5e5 #e5e5e5 #e5e5e5;animation:btn-spin .6s linear;animation-iteration-count:infinite}.i-as-btn-text{display:inline-block;vertical-align:middle}.i-as-btn-icon{font-size:14px!important;margin-right:4px}@keyframes btn-spin{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}

37
miniprogram/dist/alert/index.js vendored Normal file
View File

@ -0,0 +1,37 @@
Component({
externalClasses: ['i-class'],
options: {
multipleSlots: true
},
properties: {
//info, success, warning, error
type: {
type: String,
value: 'info'
},
closable: {
type: Boolean,
value: false
},
showIcon: {
type: Boolean,
default: false
},
desc: {
type: Boolean,
default: false
},
},
data: {
closed: false
},
methods: {
handleTap() {
this.setData({
closed: !this.data.closed,
});
this.triggerEvent('close');
},
}
});

7
miniprogram/dist/alert/index.json vendored Normal file
View File

@ -0,0 +1,7 @@
{
"component": true,
"usingComponents":
{
"i-icon": "../icon/index"
}
}

15
miniprogram/dist/alert/index.wxml vendored Normal file
View File

@ -0,0 +1,15 @@
<view class="i-class i-alert {{'i-alert-'+type}} {{showIcon?'i-alert-with-icon':''}} {{desc?'i-alert-with-desc':''}}" wx:if="{{!closed}}">
<view wx:if="{{ showIcon }}" class="i-alert-icon">
<i-icon type="prompt" wx:if="{{ type === 'info' }}" size="{{desc?24:16}}"></i-icon>
<i-icon type="success" wx:if="{{ type === 'success' }}" size="{{desc?24:16}}"></i-icon>
<i-icon type="warning" wx:if="{{ type === 'warning' }}" size="{{desc?24:16}}"></i-icon>
<i-icon type="delete" wx:if="{{ type === 'error' }}" size="{{desc?24:16}}"></i-icon>
</view>
<slot></slot>
<view class="i-alert-desc">
<slot name="desc"></slot>
</view>
<view class="i-alert-close" wx:if="{{ closable }}" bindtap="handleTap">
<i-icon type="close"></i-icon>
</view>
</view>

1
miniprogram/dist/alert/index.wxss vendored Normal file
View File

@ -0,0 +1 @@
.i-alert{position:relative;margin:10px;padding:8px 48px 8px 16px;font-size:14px;border-radius:2px;color:#fff;background:#f7f7f7;color:#495060}.i-alert.i-alert-with-icon{padding:8px 48px 8px 38px}.i-alert-info{color:#fff;background:#2db7f5}.i-alert-success{color:#fff;background:#19be6b}.i-alert-warning{color:#fff;background:#f90}.i-alert-error{color:#fff;background:#ed3f14}.i-alert-icon{position:absolute;top:9px;left:16px;font-size:14px}.i-alert-desc{font-size:12px}.i-alert-with-desc{padding:16px;position:relative}.i-alert-with-desc.i-alert-with-icon{padding:16px 16px 16px 69px}.i-alert-with-desc .i-alert-icon{top:50%;left:24px;margin-top:-21px;font-size:28px}.i-alert-close{font-size:12px;position:absolute;right:16px;top:8px;overflow:hidden;cursor:pointer}

20
miniprogram/dist/avatar/index.js vendored Normal file
View File

@ -0,0 +1,20 @@
Component({
externalClasses: ['i-class'],
properties: {
// circle || square
shape: {
type: String,
value: 'circle'
},
// small || large || default
size: {
type: String,
value: 'default'
},
src: {
type: String,
value: ''
}
}
});

3
miniprogram/dist/avatar/index.json vendored Normal file
View File

@ -0,0 +1,3 @@
{
"component": true
}

4
miniprogram/dist/avatar/index.wxml vendored Normal file
View File

@ -0,0 +1,4 @@
<view class="i-class i-avatar i-avatar-{{ shape }} i-avatar-{{ size }} {{ src ? 'i-avatar-image' : '' }}">
<image src="{{ src }}" wx:if="{{ src !== '' }}"></image>
<view class="i-avatar-string" wx:else><slot></slot></view>
</view>

1
miniprogram/dist/avatar/index.wxss vendored Normal file
View File

@ -0,0 +1 @@
.i-avatar{display:inline-block;text-align:center;background:#ccc;color:#fff;white-space:nowrap;position:relative;overflow:hidden;vertical-align:middle;width:32px;height:32px;line-height:32px;border-radius:16px;font-size:18px}.i-avatar .ivu-avatar-string{line-height:32px}.i-avatar-large{width:40px;height:40px;line-height:40px;border-radius:20px;font-size:24px}.i-avatar-large .ivu-avatar-string{line-height:40px}.i-avatar-small{width:24px;height:24px;line-height:24px;border-radius:12px;font-size:14px}.i-avatar-small .ivu-avatar-string{line-height:24px}.i-avatar-image{background:0 0}.i-avatar-square{border-radius:4px}.i-avatar>image{width:100%;height:100%}

29
miniprogram/dist/badge/index.js vendored Normal file
View File

@ -0,0 +1,29 @@
Component({
externalClasses: ['i-class', 'i-class-alone'],
properties: {
count: {
type: Number,
value: 0,
observer: 'finalCount'
},
overflowCount: {
type: Number,
value: 99
},
dot: {
type: Boolean,
value: false
},
},
data: {
finalCount: 0
},
methods: {
finalCount() {
this.setData({
finalCount: parseInt(this.data.count) >= parseInt(this.data.overflowCount) ? `${this.data.overflowCount}+` : this.data.count
});
},
}
});

3
miniprogram/dist/badge/index.json vendored Normal file
View File

@ -0,0 +1,3 @@
{
"component": true
}

5
miniprogram/dist/badge/index.wxml vendored Normal file
View File

@ -0,0 +1,5 @@
<view class="i-class i-badge">
<slot></slot>
<view class="i-badge-dot" wx:if="{{ dot }}"></view>
<view class="i-badge-count i-class-alone" wx:elif="{{ count !== 0 }}">{{ finalCount }}</view>
</view>

1
miniprogram/dist/badge/index.wxss vendored Normal file
View File

@ -0,0 +1 @@
.i-badge{position:relative;display:inline-block;line-height:1;vertical-align:middle}.i-badge-count{position:absolute;transform:translateX(50%);top:-6px;right:0;height:18px;border-radius:9px;min-width:18px;background:#ed3f14;border:1px solid transparent;color:#fff;line-height:18px;text-align:center;padding:0 5px;font-size:12px;white-space:nowrap;transform-origin:-10% center;z-index:10;box-shadow:0 0 0 1px #fff;box-sizing:border-box;text-rendering:optimizeLegibility}.i-badge-count-alone{top:auto;display:block;position:relative;transform:translateX(0)}.i-badge-dot{position:absolute;transform:translateX(-50%);transform-origin:0 center;top:-4px;right:-8px;height:8px;width:8px;border-radius:100%;background:#ed3f14;z-index:10;box-shadow:0 0 0 1px #fff}

37
miniprogram/dist/base/index.js vendored Normal file
View File

@ -0,0 +1,37 @@
function getCtx (selector) {
const pages = getCurrentPages();
const ctx = pages[pages.length - 1];
const componentCtx = ctx.selectComponent(selector);
if (!componentCtx) {
console.error('无法找到对应的组件,请按文档说明使用组件');
return null;
}
return componentCtx;
}
function Toast(options) {
const { selector = '#toast' } = options;
const ctx = getCtx(selector);
ctx.handleShow(options);
}
Toast.hide = function (selector = '#toast') {
const ctx = getCtx(selector);
ctx.handleHide();
};
function Message(options) {
const { selector = '#message' } = options;
const ctx = getCtx(selector);
ctx.handleShow(options);
}
module.exports = {
$Toast: Toast,
$Message: Message
};

80
miniprogram/dist/button/index.js vendored Normal file
View File

@ -0,0 +1,80 @@
Component({
externalClasses: ['i-class'],
properties: {
// default, primary, ghost, info, success, warning, error
type: {
type: String,
value: '',
},
inline: {
type: Boolean,
value: false
},
// default, large, small
size: {
type: String,
value: '',
},
// circle, square
shape: {
type: String,
value: 'square'
},
disabled: {
type: Boolean,
value: false,
},
loading: {
type: Boolean,
value: false,
},
long: {
type: Boolean,
value: false
},
openType: String,
appParameter: String,
hoverStopPropagation: Boolean,
hoverStartTime: {
type: Number,
value: 20
},
hoverStayTime: {
type: Number,
value: 70
},
lang: {
type: String,
value: 'en'
},
sessionFrom: {
type: String,
value: ''
},
sendMessageTitle: String,
sendMessagePath: String,
sendMessageImg: String,
showMessageCard: Boolean
},
methods: {
handleTap () {
if (this.data.disabled) return false;
this.triggerEvent('click');
},
bindgetuserinfo({ detail = {} } = {}) {
this.triggerEvent('getuserinfo', detail);
},
bindcontact({ detail = {} } = {}) {
this.triggerEvent('contact', detail);
},
bindgetphonenumber({ detail = {} } = {}) {
this.triggerEvent('getphonenumber', detail);
},
binderror({ detail = {} } = {}) {
this.triggerEvent('error', detail);
}
}
});

3
miniprogram/dist/button/index.json vendored Normal file
View File

@ -0,0 +1,3 @@
{
"component": true
}

20
miniprogram/dist/button/index.wxml vendored Normal file
View File

@ -0,0 +1,20 @@
<button
class="i-class i-btn {{ long ? 'i-btn-long' : '' }} {{ 'i-btn-' + size }} {{ 'i-btn-' + type }} {{ 'i-btn-' + shape }} {{ loading ? 'i-btn-loading' : '' }} {{ disabled ? 'i-btn-disabled' : ''}} {{ inline ? 'i-btn-inline' : '' }}"
hover-class="i-btn-hover"
bindtap="handleTap"
open-type="{{ openType }}"
app-parameter="{{ appParameter }}"
hover-stop-propagation="{{ hoverStopPropagation }}"
hover-start-time="{{ hoverStartTime }}"
hover-stay-time="{{ hoverStayTime }}"
session-from="{{ sessionFrom }}"
send-message-title="{{ sendMessageTitle }}"
send-message-path="{{ sendMessagePath }}"
send-message-img="{{ sendMessageImg }}"
show-message-card="{{ showMessageCard }}"
bindcontact="bindcontact"
bindgetuserinfo="bindgetuserinfo"
bindgetphonenumber="bindgetphonenumber"
binderror="binderror"
plain="true"
><view class="i-btn-loading-inner" wx:if="{{loading}}"></view><slot></slot></button>

1
miniprogram/dist/button/index.wxss vendored Normal file
View File

@ -0,0 +1 @@
.i-btn{text-align:center;vertical-align:middle;touch-action:manipulation;cursor:pointer;background-image:none;white-space:nowrap;user-select:none;font-size:14px;border-radius:2px;border:0!important;position:relative;text-decoration:none;height:44px;line-height:44px;box-shadow:inset 0 0 0 1px rgba(0,0,0,.1);color:#fff!important;background:#f7f7f7!important;color:#495060!important;margin:10px}.i-btn-hover{opacity:.9}.i-btn-long{border-radius:0;margin:0;box-shadow:none}.i-btn-large{height:48px;line-height:48px}.i-btn-small{height:40px;line-height:40px}.i-btn-primary{color:#fff!important;background:#2d8cf0!important}.i-btn-ghost{color:#fff!important;background:#fff!important;color:#495060!important}.i-btn-success{color:#fff!important;background:#19be6b!important}.i-btn-warning{color:#fff!important;background:#f90!important}.i-btn-error{color:#fff!important;background:#ed3f14!important}.i-btn-info{color:#fff!important;background:#2db7f5!important}.i-btn-circle{border-radius:44px}.i-btn-large.i-btn-circle{border-radius:48px}.i-btn-small.i-btn-circle{border-radius:40px}.i-btn-loading{opacity:.6}.i-btn-loading-inner{display:inline-block;margin-right:12px;vertical-align:middle;width:14px;height:14px;background:0 0;border-radius:50%;border:2px solid #fff;border-color:#fff #fff #fff transparent;animation:btn-spin .6s linear;animation-iteration-count:infinite}.i-btn-disabled{color:#bbbec4!important;background:#f7f7f7!important}.i-btn-inline{display:inline-block}@keyframes btn-spin{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}

26
miniprogram/dist/card/index.js vendored Normal file
View File

@ -0,0 +1,26 @@
Component({
externalClasses: ['i-class'],
options: {
multipleSlots: true
},
properties: {
full: {
type: Boolean,
value: false
},
thumb: {
type: String,
value: ''
},
title: {
type: String,
value: ''
},
extra: {
type: String,
value: ''
}
}
});

3
miniprogram/dist/card/index.json vendored Normal file
View File

@ -0,0 +1,3 @@
{
"component": true
}

11
miniprogram/dist/card/index.wxml vendored Normal file
View File

@ -0,0 +1,11 @@
<view class="i-class i-card {{ full ? 'i-card-full' : '' }}">
<view class="i-class i-card-header">
<view class="i-card-header-content">
<image class="i-card-header-thumb" src="{{ thumb }}" mode="aspectFit" wx:if="{{ thumb }}" />
{{ title }}
</view>
<view class="i-card-header-extra" wx:if="{{ extra }}">{{ extra }}</view>
</view>
<view class="i-class i-card-body"><slot name="content"></slot></view>
<view class="i-class i-card-footer"><slot name="footer"></slot></view>
</view>

1
miniprogram/dist/card/index.wxss vendored Normal file
View File

@ -0,0 +1 @@
.i-card{margin:0 16px;font-size:14px;overflow:hidden;position:relative;background:#fff;border:1rpx solid #dddee1;border-radius:5px}.i-card-full{margin:0;border-left:none;border-right:none;border-radius:0}.i-card-header{display:flex;padding:6px 16px;align-items:center}.i-card-header-content{flex:1;text-align:left}.i-card-header-thumb{display:inline-block;width:64px;height:64px;position:relative;margin-left:auto;margin-right:auto;overflow:hidden;background-size:cover;vertical-align:middle}.i-card-header-title{display:inline-block;vertical-align:middle;font-size:14px;color:#1c2438}.i-card-header-extra{flex:1;text-align:right;font-size:14px;color:#80848f}.i-card-body{position:relative;padding:6px 16px;color:#495060;font-size:14px}.i-card-body::before{content:'';position:absolute;top:0;left:0;width:200%;height:200%;transform:scale(.5);transform-origin:0 0;pointer-events:none;box-sizing:border-box;border:0 solid #e9eaec;border-top-width:1px}.i-card-footer{position:relative;padding:6px 16px;color:#80848f;font-size:12px}

33
miniprogram/dist/cell-group/index.js vendored Normal file
View File

@ -0,0 +1,33 @@
Component({
externalClasses: ['i-class'],
relations: {
'../cell/index': {
type: 'child',
linked () {
this._updateIsLastCell();
},
linkChanged () {
this._updateIsLastCell();
},
unlinked () {
this._updateIsLastCell();
}
}
},
methods: {
_updateIsLastCell() {
let cells = this.getRelationNodes('../cell/index');
const len = cells.length;
if (len > 0) {
let lastIndex = len - 1;
cells.forEach((cell, index) => {
cell.updateIsLastCell(index === lastIndex);
});
}
}
}
});

View File

@ -0,0 +1,3 @@
{
"component": true
}

View File

@ -0,0 +1,3 @@
<view class="i-class i-cell-group">
<slot></slot>
</view>

86
miniprogram/dist/cell/index.js vendored Normal file
View File

@ -0,0 +1,86 @@
const warn = (msg, getValue) => {
console.warn(msg);
console.log('接受到的值为:', getValue);
};
Component({
externalClasses: ['i-class'],
options: {
multipleSlots: true
},
relations: {
'../cell-group/index': {
type: 'parent'
}
},
properties: {
// 左侧标题
title: {
type: String
},
// 标题下方的描述信息
label: {
type: String
},
// 右侧内容
value: {
type: String
},
// 只有点击 footer 区域才触发 tab 事件
onlyTapFooter: {
type: Boolean
},
// 是否展示右侧箭头并开启尝试以 url 跳转
isLink: {
type: null,
value: ''
},
// 链接类型,可选值为 navigateToredirectToswitchTabreLaunch
linkType: {
type: String,
value: 'navigateTo'
},
url: {
type: String,
value: ''
}
},
data: {
isLastCell: true
},
methods: {
navigateTo () {
const { url } = this.data;
const type = typeof this.data.isLink;
this.triggerEvent('click', {});
if (!this.data.isLink || !url || url === 'true' || url === 'false') return;
if (type !== 'boolean' && type !== 'string') {
warn('isLink 属性值必须是一个字符串或布尔值', this.data.isLink);
return;
}
if (['navigateTo', 'redirectTo', 'switchTab', 'reLaunch'].indexOf(this.data.linkType) === -1) {
warn('linkType 属性可选值为 navigateToredirectToswitchTabreLaunch', this.data.linkType);
return;
}
wx[this.data.linkType].call(wx, {url});
},
handleTap () {
if (!this.data.onlyTapFooter) {
this.navigateTo();
}
},
updateIsLastCell (isLastCell) {
this.setData({ isLastCell });
}
}
});

3
miniprogram/dist/cell/index.json vendored Normal file
View File

@ -0,0 +1,3 @@
{
"component": true
}

16
miniprogram/dist/cell/index.wxml vendored Normal file
View File

@ -0,0 +1,16 @@
<view bindtap="handleTap" class="i-class i-cell {{ isLastCell ? 'i-cell-last' : '' }} {{ isLink ? 'i-cell-access' : '' }}">
<view class="i-cell-icon">
<slot name="icon"></slot>
</view>
<view class="i-cell-bd">
<view wx:if="{{ title }}" class="i-cell-text">{{ title }}</view>
<view wx:if="{{ label }}" class="i-cell-desc">{{ label }}</view>
<slot></slot>
</view>
<view catchtap="navigateTo" class="i-cell-ft">
<block wx:if="{{value}}">{{ value }}</block>
<block wx:else>
<slot name="footer"></slot>
</block>
</view>
</view>

1
miniprogram/dist/cell/index.wxss vendored Normal file
View File

@ -0,0 +1 @@
.i-cell{position:relative;padding:12px 15px;display:flex;background:#fff;align-items:center;line-height:1.4;font-size:14px;overflow:hidden}.i-cell::after{content:'';position:absolute;top:0;left:0;width:200%;height:200%;transform:scale(.5);transform-origin:0 0;pointer-events:none;box-sizing:border-box;border:0 solid #e9eaec;border-bottom-width:1px;left:15px;right:0}.i-cell-last::after{display:none}.i-cell-icon{margin-right:5px}.i-cell-icon:empty{display:none}.i-cell-bd{flex:1}.i-cell-text{line-height:24px;font-size:14px}.i-cell-desc{line-height:1.2;font-size:12px;color:#80848f}.i-cell-ft{position:relative;text-align:right;color:#495060}.i-cell-access .i-cell-ft{padding-right:13px}.i-cell-access .i-cell-ft::after{content:" ";display:inline-block;width:6px;height:6px;position:absolute;top:50%;right:2px;border-width:2px 2px 0 0;border-color:#dddee1;border-style:solid;transform:translateY(-50%) matrix(.71,.71,-.71,.71,0,0)}

View File

@ -0,0 +1,38 @@
Component({
externalClasses: ['i-class'],
relations: {
'../checkbox/index': {
type: 'child',
linked() {
this.changeCurrent();
},
linkChanged() {
this.changeCurrent();
},
unlinked() {
this.changeCurrent();
}
}
},
properties: {
current: {
type: Array,
value: [],
observer: 'changeCurrent'
},
},
methods: {
changeCurrent(val = this.data.current) {
let items = this.getRelationNodes('../checkbox/index');
const len = items.length;
if (len > 0) {
items.forEach(item => {
item.changeCurrent(val.indexOf(item.data.value) !== -1);
});
}
},
emitEvent(current) {
this.triggerEvent('change', current);
}
}
});

View File

@ -0,0 +1,7 @@
{
"component": true,
"usingComponents":
{
"i-cell-group": "../cell-group/index"
}
}

View File

@ -0,0 +1,3 @@
<i-cell-group class="i-class">
<slot></slot>
</i-cell-group>

View File

56
miniprogram/dist/checkbox/index.js vendored Normal file
View File

@ -0,0 +1,56 @@
const prefixCls = 'i-checkbox';
Component({
externalClasses: ['i-class'],
relations: {
'../checkbox-group/index': {
type: 'parent'
}
},
properties: {
value: {
type: String,
value: ''
},
checked: {
type: Boolean,
value: false
},
disabled: {
type: Boolean,
value: false
},
color: {
type: String,
value: '#2d8cf0'
},
position: {
type: String,
value: 'left', //left right
observer: 'setPosition'
}
},
data: {
checked: true,
positionCls: `${prefixCls}-checkbox-left`,
},
attached() {
this.setPosition();
},
methods: {
changeCurrent(current) {
this.setData({ checked: current });
},
checkboxChange() {
if (this.data.disabled) return;
const item = { current: !this.data.checked, value: this.data.value };
const parent = this.getRelationNodes('../checkbox-group/index')[0];
parent ? parent.emitEvent(item) : this.triggerEvent('change', item);
},
setPosition() {
this.setData({
positionCls: this.data.position.indexOf('left') !== -1 ? `${prefixCls}-checkbox-left` : `${prefixCls}-checkbox-right`,
});
}
}
});

7
miniprogram/dist/checkbox/index.json vendored Normal file
View File

@ -0,0 +1,7 @@
{
"component": true,
"usingComponents":
{
"i-cell": "../cell/index"
}
}

8
miniprogram/dist/checkbox/index.wxml vendored Normal file
View File

@ -0,0 +1,8 @@
<view class="i-class i-checkbox" catchtap="checkboxChange">
<i-cell i-class="i-checkbox-cell">
<label>
<radio value="{{value}}" checked="{{checked}}" color="{{checked?color:''}}" disabled="{{disabled}}" class="i-checkbox-radio {{positionCls}}" />
<view class="i-checkbox-title">{{value}}</view>
</label>
</i-cell>
</view>

1
miniprogram/dist/checkbox/index.wxss vendored Normal file
View File

@ -0,0 +1 @@
.i-checkbox-cell::after{display:block}.i-checkbox-checkbox-left{float:left}.i-checkbox-checkbox-right{float:right}.i-checkbox-radio{vertical-align:middle}.i-checkbox-title{display:inline-block;vertical-align:middle}

View File

@ -0,0 +1,47 @@
Component({
properties: {
currentProgress:{
type: Number,
value: 0,
observer: '_progressDidChange',
},
size:{
type: Number,
value: 200
},
borderSize:{
type: Number,
value: 20
},
borderColor:{
type: String,
value: "green"
},
normalColor:{
type: String,
value: "gray"
}
},
data: {
rightCircleRadius: 135,
leftCircleRadius: 135,
},
methods: {
_progressDidChange: function(newVal,oldVal){
var that = this;
var newLeftRadius = that.data.leftCircleRadius;
var newRightRadius = that.data.rightCircleRadius;
var radius = 360 * newVal;
if(newVal < 0.5 && newVal >= 0){
//只需要旋转右边的值
newLeftRadius = 135;
newRightRadius = 135 + radius;
}else if(newVal <= 1 && newVal >=0.5){
//两边都需要旋转
newLeftRadius = radius - 45;
newRightRadius = -45;
}
that.setData({rightCircleRadius:newRightRadius,leftCircleRadius:newLeftRadius});
}
}
})

View File

@ -0,0 +1,4 @@
{
"component": true,
"usingComponents": {}
}

View File

@ -0,0 +1,11 @@
<!--miniprogram/dist/circle-progress/circle-progress.wxml-->
<view class='circle-progress-container' style="width: {{size}}rpx;height: {{size}}rpx;">
<view class="circle-progress-outter-circle" style="width: {{size}}rpx;height: {{size}}rpx;border: {{borderSize}}rpx solid {{normalColor}};">
</view>
<view class='circle-progress-half-rect right-rect' style="width: {{size/2+1}}rpx;height: {{size}}rpx;">
<view wx:if="{{currentProgress>0}}" class='circle-progress-half-circle right-circle' style="transform: rotate({{rightCircleRadius}}deg);width: {{size}}rpx;height: {{size}}rpx; border: {{borderSize}}rpx solid transparent;border-right: {{borderSize}}rpx solid {{borderColor}};border-bottom: {{borderSize}}rpx solid {{borderColor}};" ></view>
</view>
<view class='circle-progress-half-rect left-rect' style="width: {{size/2+1}}rpx;height: {{size}}rpx;">
<view wx:if="{{currentProgress>0.5}}" class='circle-progress-half-circle left-circle' style="transform: rotate({{leftCircleRadius}}deg);width: {{size}}rpx;height: {{size}}rpx; border: {{borderSize}}rpx solid transparent;border-left: {{borderSize}}rpx solid {{borderColor}};border-top: {{borderSize}}rpx solid {{borderColor}};"></view>
</view>
</view>

View File

@ -0,0 +1,32 @@
/* miniprogram/dist/circle-progress/circle-progress.wxss */
.circle-progress-outter-circle{
border-radius: 50%;
box-sizing: border-box;
}
.circle-progress-half-rect{
position: absolute;
overflow: hidden;
}
.right-rect{
top: 0;
right: 0;
}
.left-rect{
top: 0;
left: 0;
}
.circle-progress-half-circle{
border-radius: 50%;
box-sizing: border-box;
position: absolute;
}
.right-circle{
top:0;
right: 0;
transform: rotate(-45deg);
}
.left-circle{
top:0;
left: 0;
transform: rotate(-45deg);
}

20
miniprogram/dist/col/index.js vendored Normal file
View File

@ -0,0 +1,20 @@
Component({
externalClasses: ['i-class'],
relations: {
'../row/index': {
type: 'parent'
}
},
properties: {
span: {
value: 0,
type: Number
},
offset: {
value: 0,
type: Number
}
}
});

3
miniprogram/dist/col/index.json vendored Normal file
View File

@ -0,0 +1,3 @@
{
"component": true
}

1
miniprogram/dist/col/index.wxml vendored Normal file
View File

@ -0,0 +1 @@
<view class="i-class i-col {{ span ? 'i-col-span-' + span : '' }} {{ offset ? 'i-col-offset-' + offset : '' }}"><slot></slot></view>

1
miniprogram/dist/col/index.wxss vendored Normal file
View File

@ -0,0 +1 @@
.i-col{float:left;box-sizing:border-box;width:0}.i-col-span-1{display:block;width:4.16666667%}.i-col-offset-1{margin-left:4.16666667%}.i-col-span-2{display:block;width:8.33333333%}.i-col-offset-2{margin-left:8.33333333%}.i-col-span-3{display:block;width:12.5%}.i-col-offset-3{margin-left:12.5%}.i-col-span-4{display:block;width:16.66666667%}.i-col-offset-4{margin-left:16.66666667%}.i-col-span-5{display:block;width:20.83333333%}.i-col-offset-5{margin-left:20.83333333%}.i-col-span-6{display:block;width:25%}.i-col-offset-6{margin-left:25%}.i-col-span-7{display:block;width:29.16666667%}.i-col-offset-7{margin-left:29.16666667%}.i-col-span-8{display:block;width:33.33333333%}.i-col-offset-8{margin-left:33.33333333%}.i-col-span-9{display:block;width:37.5%}.i-col-offset-9{margin-left:37.5%}.i-col-span-10{display:block;width:41.66666667%}.i-col-offset-10{margin-left:41.66666667%}.i-col-span-11{display:block;width:45.83333333%}.i-col-offset-11{margin-left:45.83333333%}.i-col-span-12{display:block;width:50%}.i-col-offset-12{margin-left:50%}.i-col-span-13{display:block;width:54.16666667%}.i-col-offset-13{margin-left:54.16666667%}.i-col-span-14{display:block;width:58.33333333%}.i-col-offset-14{margin-left:58.33333333%}.i-col-span-15{display:block;width:62.5%}.i-col-offset-15{margin-left:62.5%}.i-col-span-16{display:block;width:66.66666667%}.i-col-offset-16{margin-left:66.66666667%}.i-col-span-17{display:block;width:70.83333333%}.i-col-offset-17{margin-left:70.83333333%}.i-col-span-18{display:block;width:75%}.i-col-offset-18{margin-left:75%}.i-col-span-19{display:block;width:79.16666667%}.i-col-offset-19{margin-left:79.16666667%}.i-col-span-20{display:block;width:83.33333333%}.i-col-offset-20{margin-left:83.33333333%}.i-col-span-21{display:block;width:87.5%}.i-col-offset-21{margin-left:87.5%}.i-col-span-22{display:block;width:91.66666667%}.i-col-offset-22{margin-left:91.66666667%}.i-col-span-23{display:block;width:95.83333333%}.i-col-offset-23{margin-left:95.83333333%}.i-col-span-24{display:block;width:100%}.i-col-offset-24{margin-left:100%}

46
miniprogram/dist/collapse-item/index.js vendored Normal file
View File

@ -0,0 +1,46 @@
Component({
externalClasses: ['i-class-content', 'i-class-title', 'i-class'],
relations: {
'../collapse/index': {
type: 'parent',
linked: function (target) {
const options = {
accordion: target.data.accordion
}
if (target.data.name === this.data.name) {
options.showContent = 'i-collapse-item-show-content';
}
this.setData(options);
}
}
},
properties: {
title: String,
name: String
},
data: {
showContent: '',
accordion: false
},
options: {
multipleSlots: true
},
methods: {
trigger(e) {
const data = this.data;
if (data.accordion) {
this.triggerEvent('collapse', {name: data.name}, {composed: true, bubbles: true});
} else {
this.setData({
showContent: data.showContent ? '' : 'i-collapse-item-show-content'
});
}
},
}
});

View File

@ -0,0 +1,7 @@
{
"component": true,
"usingComponents": {
"i-icon": "../icon/index"
}
}

View File

@ -0,0 +1,9 @@
<view id="{{name}}" class="i-class i-collapse-item ">
<view class="i-collapse-item-title-wrap" bindtap="trigger">
<i-icon size="16" type="enter" i-class="{{ showContent ? 'i-collapse-item-arrow-show' : 'i-collapse-item-arrow' }}"/>
<text class="i-collapse-item-title i-class-title">{{title}}</text>
</view>
<view class="i-collapse-item-content {{showContent}} i-class-content">
<slot name="content"></slot>
</view>
</view>

View File

@ -0,0 +1 @@
.i-collapse-item{padding:2px 8px;border-top:1px solid #dddee1}.i-collapse-item-title{vertical-align:middle}.i-collapse-item-title-wrap{padding:2px 0 0}.i-collapse-item-content{padding:6px;display:none}.i-collapse-item-show-content{display:block}.i-collapse-item-arrow{transition:transform .2s ease-in-out}.i-collapse-item-arrow-show{transition:transform .2s ease-in-out;transform:rotate(90deg)}

31
miniprogram/dist/collapse/index.js vendored Normal file
View File

@ -0,0 +1,31 @@
Component({
externalClasses: ['i-class'],
relations: {
'../collapse-item/index': {
type: 'child'
}
},
properties: {
name: String,
accordion: Boolean
},
methods: {
clickfn(e) {
const params = e.detail;
const allList = this.getRelationNodes('../collapse-item/index');
allList.forEach((item) => {
if (params.name === item.data.name) {
item.setData({
showContent: 'i-collapse-item-show-content'
});
} else {
item.setData({
showContent: ''
});
}
});
},
}
});

3
miniprogram/dist/collapse/index.json vendored Normal file
View File

@ -0,0 +1,3 @@
{
"component": true
}

4
miniprogram/dist/collapse/index.wxml vendored Normal file
View File

@ -0,0 +1,4 @@
<view class="i-class i-collapse" bindcollapse="clickfn">
<slot></slot>
</view>

0
miniprogram/dist/collapse/index.wxss vendored Normal file
View File

90
miniprogram/dist/count-down/index.js vendored Normal file
View File

@ -0,0 +1,90 @@
Component({
properties: {
target: Number,
showDay: Boolean,
callback: String,
format: Array,
clearTimer: Boolean
},
externalClasses: ['countdown-class'],
data: {
time: '',
resultFormat: [],
changeFormat: false
},
ready() {
this.getFormat();
},
methods: {
getFormat() {
const data = this.data;
const len = data.format.length;
if (!data.showDay) data.resultFormat.push('');
if (len >= 3) {
for (let i = 0; i < len; i++) {
if (data.resultFormat.length >= 4) break;
if (data.format[i]) {
data.resultFormat.push(data.format[i].toString());
}
}
if (data.resultFormat.length >= 4) data.changeFormat = true;
}
this.getLastTime();
},
init() {
const self = this;
setTimeout(function () {
self.getLastTime.call(self);
}, 1000);
},
getLastTime() {
const data = this.data;
const gapTime = Math.ceil((data.target - new Date().getTime()) / 1000);
let result = '';
let time = '00:00:00';
let day = '00';
const format = data.resultFormat;
if (gapTime > 0) {
day = this.formatNum(parseInt(gapTime / 86400));
let lastTime = gapTime % 86400;
const hour = this.formatNum(parseInt(lastTime / 3600));
lastTime = lastTime % 3600;
const minute = this.formatNum(parseInt(lastTime / 60));
const second = this.formatNum(lastTime % 60);
if (data.changeFormat) time = `${hour}${format[1]}${minute}${format[2]}${second}${format[3]}`;
else time = `${hour}:${minute}:${second}`;
if (!data.clearTimer) this.init.call(this);
} else {
this.endfn();
}
if (data.showDay) {
if (data.changeFormat) {
result = `${day}${format[0]} ${time}`;
} else {
result = `${day}d ${time}`;
}
} else {
result = time;
}
this.setData({
time: result
});
},
formatNum(num) {
return num > 9 ? num : `0${num}`;
},
endfn() {
this.triggerEvent('callback', {});
}
}
});

View File

@ -0,0 +1,4 @@
{
"component": true
}

View File

@ -0,0 +1,4 @@
<text class="countdown-class">
{{time}}
</text>

View File

25
miniprogram/dist/divider/index.js vendored Normal file
View File

@ -0,0 +1,25 @@
Component({
externalClasses: ['i-class'],
properties: {
content: {
type: String,
value: ''
},
height : {
type: Number,
value: 48
},
color : {
type : String,
value : '#80848f'
},
lineColor : {
type : String,
value : '#e9eaec'
},
size : {
type: String,
value: 12
}
}
});

3
miniprogram/dist/divider/index.json vendored Normal file
View File

@ -0,0 +1,3 @@
{
"component": true
}

19
miniprogram/dist/divider/index.wxml vendored Normal file
View File

@ -0,0 +1,19 @@
<view class="i-divider i-class" style="{{parse.getStyle(color,size,height)}}">
<view class="i-divider-content" wx:if="{{content !== ''}}">
{{content}}
</view>
<view class="i-divider-content" wx:else>
<slot></slot>
</view>
<view class="i-divider-line" style="background:{{lineColor}}"></view>
</view>
<wxs module="parse">
module.exports = {
getStyle : function(color,size,height){
var color = 'color:' + color +';';
var size = 'font-size:' + size + 'px;';
var height = 'height:' + height+'px;'
return color + size + height;
}
}
</wxs>

1
miniprogram/dist/divider/index.wxss vendored Normal file
View File

@ -0,0 +1 @@
.i-divider{width:100%;text-align:center;font-size:12px;position:relative;display:flex;align-items:center;justify-content:center}.i-divider-line{position:absolute;left:0;width:100%;height:1rpx;background-color:#f7f7f7;top:50%}.i-divider-content{background:#fff;position:relative;z-index:1;display:inline-block;padding:0 10px}

33
miniprogram/dist/drawer/index.js vendored Normal file
View File

@ -0,0 +1,33 @@
Component({
externalClasses: ['i-class'],
properties: {
visible: {
type: Boolean,
value: false
},
mask: {
type: Boolean,
value: true
},
maskClosable: {
type: Boolean,
value: true
},
mode: {
type: String,
value: 'left' // left right
}
},
data: {},
methods: {
handleMaskClick() {
if (!this.data.maskClosable) {
return;
}
this.triggerEvent('close', {});
}
}
});

3
miniprogram/dist/drawer/index.json vendored Normal file
View File

@ -0,0 +1,3 @@
{
"component": true
}

6
miniprogram/dist/drawer/index.wxml vendored Normal file
View File

@ -0,0 +1,6 @@
<view class="i-class i-drawer {{ visible ? 'i-drawer-show' : '' }} {{ 'i-drawer-' + mode }}">
<view wx:if="{{ mask }}" class="i-drawer-mask" bindtap="handleMaskClick"></view>
<view class="i-drawer-container">
<slot></slot>
</view>
</view>

1
miniprogram/dist/drawer/index.wxss vendored Normal file
View File

@ -0,0 +1 @@
.i-drawer{visibility:hidden}.i-drawer-show{visibility:visible}.i-drawer-show .i-drawer-mask{display:block;opacity:1}.i-drawer-show .i-drawer-container{opacity:1}.i-drawer-show.i-drawer-left .i-drawer-container,.i-drawer-show.i-drawer-right .i-drawer-container{transform:translate3d(0,-50%,0)}.i-drawer-mask{opacity:0;position:fixed;top:0;left:0;right:0;bottom:0;z-index:6;background:rgba(0,0,0,.6);transition:all .3s ease-in-out}.i-drawer-container{position:fixed;left:50%;top:50%;transform:translate3d(-50%,-50%,0);transform-origin:center;transition:all .3s ease-in-out;z-index:7;opacity:0}.i-drawer-left .i-drawer-container{left:0;top:50%;transform:translate3d(-100%,-50%,0)}.i-drawer-right .i-drawer-container{right:0;top:50%;left:auto;transform:translate3d(100%,-50%,0)}

10
miniprogram/dist/grid-icon/index.js vendored Normal file
View File

@ -0,0 +1,10 @@
Component({
externalClasses: ['i-class'],
relations: {
'../grid-item/index': {
type: 'parent'
}
},
});

3
miniprogram/dist/grid-icon/index.json vendored Normal file
View File

@ -0,0 +1,3 @@
{
"component": true
}

1
miniprogram/dist/grid-icon/index.wxml vendored Normal file
View File

@ -0,0 +1 @@
<view class="i-class i-grid-icon"><slot></slot></view>

1
miniprogram/dist/grid-icon/index.wxss vendored Normal file
View File

@ -0,0 +1 @@
.i-grid-icon{display:block;width:28px;height:28px;margin:0 auto}.i-grid-icon image{width:100%;height:100%}

16
miniprogram/dist/grid-item/index.js vendored Normal file
View File

@ -0,0 +1,16 @@
Component({
externalClasses: ['i-class'],
relations: {
'../grid/index': {
type: 'parent'
},
'../grid-icon/index': {
type: 'child'
}
},
data: {
width: '33.33%'
}
});

3
miniprogram/dist/grid-item/index.json vendored Normal file
View File

@ -0,0 +1,3 @@
{
"component": true
}

1
miniprogram/dist/grid-item/index.wxml vendored Normal file
View File

@ -0,0 +1 @@
<view class="i-class i-grid-item" style="width: {{ width }}"><slot></slot></view>

1
miniprogram/dist/grid-item/index.wxss vendored Normal file
View File

@ -0,0 +1 @@
.i-grid-item{position:relative;float:left;padding:20px 10px;width:33.33333333%;box-sizing:border-box;border-right:1rpx solid #e9eaec;border-bottom:1rpx solid #e9eaec}

10
miniprogram/dist/grid-label/index.js vendored Normal file
View File

@ -0,0 +1,10 @@
Component({
externalClasses: ['i-class'],
relations: {
'../grid-item/index': {
type: 'parent'
}
},
});

View File

@ -0,0 +1,3 @@
{
"component": true
}

View File

@ -0,0 +1 @@
<view class="i-class i-grid-label"><slot></slot></view>

View File

@ -0,0 +1 @@
.i-grid-label{margin-top:5px;display:block;text-align:center;color:#1c2438;font-size:14px;white-space:nowrap;text-overflow:ellipsis;overflow:hidden}

50
miniprogram/dist/grid/index.js vendored Normal file
View File

@ -0,0 +1,50 @@
Component({
externalClasses: ['i-class'],
relations: {
'../grid-item/index': {
type: 'child',
linked () {
this.setGridItemWidth();
},
linkChanged () {
this.setGridItemWidth();
},
unlinked () {
this.setGridItemWidth();
}
}
},
methods: {
setGridItemWidth () {
const nodes = this.getRelationNodes('../grid-item/index');
// const len = nodes.length;
// if (len < 3) {
// nodes.forEach(item => {
// item.setData({
// 'width': '33.33%'
// });
// });
// } else {
// const width = 100 / nodes.length;
// nodes.forEach(item => {
// item.setData({
// 'width': width + '%'
// });
// });
// }
const width = 100 / nodes.length;
nodes.forEach(item => {
item.setData({
'width': width + '%'
});
});
}
},
ready () {
this.setGridItemWidth();
}
});

Some files were not shown because too many files have changed in this diff Show More