答题活动准备
This commit is contained in:
parent
b9b2212065
commit
a3250d97f4
54
app.js
54
app.js
|
|
@ -21,17 +21,26 @@ App({
|
|||
},
|
||||
success: function (res) {
|
||||
if (res.data.code == 1) {
|
||||
wx.setStorageSync('userid', res.data.userid)
|
||||
wx.setStorageSync('username', res.data.username)
|
||||
if (res.header.hasOwnProperty('Set-Cookie')){
|
||||
wx.setStorageSync('sessionid', res.header["Set-Cookie"])
|
||||
}else{
|
||||
wx.setStorageSync('sessionid', res.header["set-cookie"])
|
||||
}
|
||||
wx.setStorageSync('mpopenid', res.data.mpopenid)
|
||||
if (that.callback) { //这个函数名字和你定义的一样即可
|
||||
that.callback() //执行定义的回调函数
|
||||
}
|
||||
that.globalData.userInfo.name = res.data.name
|
||||
that.globalData.userInfo.username = res.data.username
|
||||
that.globalData.userInfo.userid = res.data.userid
|
||||
that.globalData.userInfo.mpopenid = res.data.mpopenid
|
||||
that.globalData.userInfo.perms = res.data.rights //拉取权限
|
||||
that.globalData.userInfo.companyid = res.data.companyid
|
||||
// if (that.callback) { //这个函数名字和你定义的一样即可
|
||||
// that.callback() //执行定义的回调函数
|
||||
// }
|
||||
/**** KEY PART START ****/
|
||||
var pages = getCurrentPages() // get all current pages
|
||||
var currentPage = pages[pages.length - 1] // Get current loading page
|
||||
currentPage.callback(); // Callback
|
||||
that.oncallback = false; // Callback called
|
||||
/**** KEY PART END ****/
|
||||
let openid = res.data.openid;
|
||||
if(openid==null){
|
||||
wx.showModal({
|
||||
|
|
@ -59,28 +68,12 @@ App({
|
|||
data: {},
|
||||
success: res => {
|
||||
if (res.data.code == 1) {
|
||||
that.globalData.isaqy = 1
|
||||
that.globalData.userInfo.isaqy = 1
|
||||
}
|
||||
}
|
||||
});
|
||||
//拉取权限
|
||||
wx.request({
|
||||
url: getApp().globalData.serverUrl + 'api/rights?a=have',
|
||||
header: {
|
||||
'content-type': 'application/json', // 默认值
|
||||
'Cookie': wx.getStorageSync("sessionid"),
|
||||
},
|
||||
data: {},
|
||||
success: res => {
|
||||
if (res.statusCode === 200) {
|
||||
console.log(res.data.rights)
|
||||
that.globalData.rights = res.data.rights
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
} else {
|
||||
wx.setStorageSync('mpopenid', res.data.mpopenid)
|
||||
that.globalData.userInfo.mpopenid = res.data.mpopenid
|
||||
wx.reLaunch({
|
||||
url: '/pages/bind/binduser?mpopenid=' + res.data.mpopenid,
|
||||
})
|
||||
|
|
@ -106,12 +99,19 @@ App({
|
|||
})
|
||||
},
|
||||
globalData: {
|
||||
userInfo: null,
|
||||
userInfo: {
|
||||
userid:0,
|
||||
username:'',
|
||||
name:'',
|
||||
isaqy:0,
|
||||
mpopenid:'',
|
||||
companyid:'',
|
||||
perms:[]
|
||||
},
|
||||
serverUrl: 'https://safeyun.ctcshe.com/',
|
||||
//serverUrl: 'http://127.0.0.1:8000/',
|
||||
//serverUrl: 'http://192.168.0.102:8000/',
|
||||
//serverUrl: 'http://192.168.0.107:8000/',
|
||||
//serverUrl:'http://10.0.11.195:8000/',
|
||||
isaqy: 0,
|
||||
timepass:null //定时器
|
||||
},
|
||||
|
||||
|
|
|
|||
7
app.json
7
app.json
|
|
@ -70,7 +70,12 @@
|
|||
"pages/risktask/detail",
|
||||
"pages/riskact/index2",
|
||||
"pages/area/detail",
|
||||
"pages/bindwxtz/index"
|
||||
"pages/bindwxtz/index",
|
||||
"pages/examtest/note2",
|
||||
"pages/data/index",
|
||||
"pages/examtest/rate",
|
||||
"pages/data/detail",
|
||||
"pages/totalrate/index"
|
||||
],
|
||||
"window": {
|
||||
"backgroundTextStyle": "light",
|
||||
|
|
|
|||
1
app.wxss
1
app.wxss
|
|
@ -1,6 +1,5 @@
|
|||
/**app.wxss**/
|
||||
@import 'weui.wxss';
|
||||
@import "/wxParse/wxParse.wxss";
|
||||
page{
|
||||
background-color: #F8F8F8;
|
||||
font-size: 16px;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,170 @@
|
|||
module.exports =
|
||||
/******/ (function(modules) { // webpackBootstrap
|
||||
/******/ // The module cache
|
||||
/******/ var installedModules = {};
|
||||
/******/
|
||||
/******/ // The require function
|
||||
/******/ function __webpack_require__(moduleId) {
|
||||
/******/
|
||||
/******/ // Check if module is in cache
|
||||
/******/ if(installedModules[moduleId]) {
|
||||
/******/ return installedModules[moduleId].exports;
|
||||
/******/ }
|
||||
/******/ // Create a new module (and put it into the cache)
|
||||
/******/ var module = installedModules[moduleId] = {
|
||||
/******/ i: moduleId,
|
||||
/******/ l: false,
|
||||
/******/ exports: {}
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // Execute the module function
|
||||
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
||||
/******/
|
||||
/******/ // Flag the module as loaded
|
||||
/******/ module.l = true;
|
||||
/******/
|
||||
/******/ // Return the exports of the module
|
||||
/******/ return module.exports;
|
||||
/******/ }
|
||||
/******/
|
||||
/******/
|
||||
/******/ // expose the modules object (__webpack_modules__)
|
||||
/******/ __webpack_require__.m = modules;
|
||||
/******/
|
||||
/******/ // expose the module cache
|
||||
/******/ __webpack_require__.c = installedModules;
|
||||
/******/
|
||||
/******/ // define getter function for harmony exports
|
||||
/******/ __webpack_require__.d = function(exports, name, getter) {
|
||||
/******/ if(!__webpack_require__.o(exports, name)) {
|
||||
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
|
||||
/******/ }
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // define __esModule on exports
|
||||
/******/ __webpack_require__.r = function(exports) {
|
||||
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
||||
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||
/******/ }
|
||||
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // create a fake namespace object
|
||||
/******/ // mode & 1: value is a module id, require it
|
||||
/******/ // mode & 2: merge all properties of value into the ns
|
||||
/******/ // mode & 4: return value when already ns object
|
||||
/******/ // mode & 8|1: behave like require
|
||||
/******/ __webpack_require__.t = function(value, mode) {
|
||||
/******/ if(mode & 1) value = __webpack_require__(value);
|
||||
/******/ if(mode & 8) return value;
|
||||
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
|
||||
/******/ var ns = Object.create(null);
|
||||
/******/ __webpack_require__.r(ns);
|
||||
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
|
||||
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
|
||||
/******/ return ns;
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
||||
/******/ __webpack_require__.n = function(module) {
|
||||
/******/ var getter = module && module.__esModule ?
|
||||
/******/ function getDefault() { return module['default']; } :
|
||||
/******/ function getModuleExports() { return module; };
|
||||
/******/ __webpack_require__.d(getter, 'a', getter);
|
||||
/******/ return getter;
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // Object.prototype.hasOwnProperty.call
|
||||
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
||||
/******/
|
||||
/******/ // __webpack_public_path__
|
||||
/******/ __webpack_require__.p = "";
|
||||
/******/
|
||||
/******/
|
||||
/******/ // Load entry module and return exports
|
||||
/******/ return __webpack_require__(__webpack_require__.s = 1);
|
||||
/******/ })
|
||||
/************************************************************************/
|
||||
/******/ ([
|
||||
/* 0 */,
|
||||
/* 1 */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
|
||||
Component({
|
||||
options: {
|
||||
multipleSlots: true,
|
||||
addGlobalClass: true
|
||||
},
|
||||
properties: {
|
||||
title: {
|
||||
type: String,
|
||||
value: ''
|
||||
},
|
||||
showCancel: {
|
||||
type: Boolean,
|
||||
value: true
|
||||
},
|
||||
cancelText: {
|
||||
type: String,
|
||||
value: '取消'
|
||||
},
|
||||
maskClass: {
|
||||
type: String,
|
||||
value: ''
|
||||
},
|
||||
extClass: {
|
||||
type: String,
|
||||
value: ''
|
||||
},
|
||||
maskClosable: {
|
||||
type: Boolean,
|
||||
value: true
|
||||
},
|
||||
mask: {
|
||||
type: Boolean,
|
||||
value: true
|
||||
},
|
||||
show: {
|
||||
type: Boolean,
|
||||
value: false
|
||||
},
|
||||
actions: {
|
||||
type: Array,
|
||||
value: [],
|
||||
observer: '_groupChange'
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
_groupChange: function _groupChange(e) {
|
||||
if (e.length > 0 && typeof e[0] !== 'string' && !(e[0] instanceof Array)) {
|
||||
this.setData({
|
||||
actions: [this.data.actions]
|
||||
});
|
||||
}
|
||||
},
|
||||
buttonTap: function buttonTap(e) {
|
||||
var _e$currentTarget$data = e.currentTarget.dataset,
|
||||
value = _e$currentTarget$data.value,
|
||||
groupindex = _e$currentTarget$data.groupindex,
|
||||
index = _e$currentTarget$data.index;
|
||||
|
||||
this.triggerEvent('actiontap', { value: value, groupindex: groupindex, index: index });
|
||||
},
|
||||
closeActionSheet: function closeActionSheet(e) {
|
||||
var type = e.currentTarget.dataset.type;
|
||||
|
||||
if (this.data.maskClosable || type) {
|
||||
this.setData({
|
||||
show: false
|
||||
});
|
||||
this.triggerEvent('close');
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
/***/ })
|
||||
/******/ ]);
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"component": true,
|
||||
"usingComponents": {}
|
||||
}
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
<wxs module="utils">
|
||||
var join = function(a,b) {
|
||||
return a+b
|
||||
};
|
||||
var isNotSlot = function(v) {
|
||||
return typeof v !== 'string'
|
||||
}
|
||||
module.exports = {
|
||||
join: join,
|
||||
isNotSlot: isNotSlot
|
||||
}
|
||||
</wxs>
|
||||
|
||||
<view wx:if="{{mask}}" class="weui-mask {{show ? '' : 'weui-mask_hidden'}} {{maskClass}}" bindtap="closeActionSheet"></view>
|
||||
<view class="weui-actionsheet {{show ? 'weui-actionsheet_toggle' : ''}} {{extClass}}">
|
||||
<!-- 标题 -->
|
||||
<block wx:if="{{title}}">
|
||||
<view class="weui-actionsheet__title">
|
||||
<view class="weui-actionsheet__title-text">{{title}}</view>
|
||||
</view>
|
||||
</block>
|
||||
<slot name="title" wx:else></slot>
|
||||
<view
|
||||
class="{{ !showCancel && index === actions.length-1 ? 'weui-actionsheet__action' : 'weui-actionsheet__menu' }}"
|
||||
wx:key="*this"
|
||||
wx:for-item="actionItem"
|
||||
wx:for-index="index"
|
||||
wx:for="{{actions}}"
|
||||
>
|
||||
<block wx:if="{{utils.isNotSlot(actionItem)}}">
|
||||
<view
|
||||
class="weui-actionsheet__cell {{item.type === 'warn' ? 'weui-actionsheet__cell_warn' : '' }}"
|
||||
wx:key="*this"
|
||||
wx:for="{{actionItem}}"
|
||||
wx:for-index="actionIndex"
|
||||
data-groupindex="{{index}}"
|
||||
data-index="{{actionIndex}}"
|
||||
data-value="{{item.value}}"
|
||||
bindtap="buttonTap"
|
||||
>
|
||||
{{item.text}}
|
||||
</view>
|
||||
</block>
|
||||
<slot name="{{actionItem}}" wx:else></slot>
|
||||
</view>
|
||||
<!-- 取消按钮 -->
|
||||
<view class="weui-actionsheet__action" wx:if="{{showCancel}}">
|
||||
<view class="weui-actionsheet__cell" data-type="close" id="iosActionsheetCancel" bindtap="closeActionSheet">{{cancelText}}</view>
|
||||
</view>
|
||||
</view>
|
||||
|
|
@ -0,0 +1 @@
|
|||
.weui-mask{position:fixed;z-index:1000;top:0;right:0;left:0;bottom:0;background:rgba(0,0,0,0.6)}.weui-mask_transparent{position:fixed;z-index:1000;top:0;right:0;left:0;bottom:0}.weui-actionsheet{position:fixed;left:0;bottom:0;transform:translate(0, 100%);backface-visibility:hidden;z-index:5000;width:100%;background-color:#EAE7E8;transition:transform .3s;border-top-left-radius:12px;border-top-right-radius:12px;overflow:hidden}.weui-actionsheet__title{position:relative;height:56px;padding:0 24px;display:flex;justify-content:center;flex-direction:column;text-align:center;font-size:12px;color:rgba(0,0,0,0.5);line-height:1.4;background:#FFFFFF}.weui-actionsheet__title:before{content:" ";position:absolute;left:0;bottom:0;right:0;height:1px;border-bottom:1rpx solid rgba(0,0,0,0.1);color:rgba(0,0,0,0.1)}.weui-actionsheet__title .weui-actionsheet__title-text{overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.weui-actionsheet__menu{color:rgba(0,0,0,0.9);background-color:#FFFFFF}.weui-actionsheet__action{margin-top:8px;background-color:#FFFFFF;padding-bottom:constant(safe-area-inset-bottom);padding-bottom:env(safe-area-inset-bottom)}.weui-actionsheet__cell{position:relative;padding:16px;text-align:center;font-size:17px;line-height:1.41176471}.weui-actionsheet__cell:before{content:" ";position:absolute;left:0;top:0;right:0;height:1px;border-top:1rpx solid rgba(0,0,0,0.1);color:rgba(0,0,0,0.1)}.weui-actionsheet__cell:active{background-color:#ECECEC}.weui-actionsheet__cell:first-child:before{display:none}.weui-actionsheet__cell_warn{color:#FA5151}.weui-skin_android .weui-actionsheet{position:fixed;left:50%;top:50%;bottom:auto;transform:translate(-50%, -50%);width:274px;box-sizing:border-box;backface-visibility:hidden;background:transparent;transition:transform .3s;border-radius:2px}.weui-skin_android .weui-actionsheet__action{display:none}.weui-skin_android .weui-actionsheet__menu{border-radius:2px;box-shadow:0 6px 30px 0 rgba(0,0,0,0.1)}.weui-skin_android .weui-actionsheet__cell{padding:16px;font-size:17px;line-height:1.41176471;color:rgba(0,0,0,0.9);text-align:left}.weui-skin_android .weui-actionsheet__cell:first-child{border-top-left-radius:2px;border-top-right-radius:2px}.weui-skin_android .weui-actionsheet__cell:last-child{border-bottom-left-radius:2px;border-bottom-right-radius:2px}.weui-actionsheet_toggle{transform:translate(0, 0)}.weui-mask.weui-mask_hidden{opacity:0;transform:scale3d(1, 1, 0)}.weui-mask{opacity:1;transform:scale3d(1, 1, 1);transition:all .3s}
|
||||
|
|
@ -0,0 +1,114 @@
|
|||
module.exports =
|
||||
/******/ (function(modules) { // webpackBootstrap
|
||||
/******/ // The module cache
|
||||
/******/ var installedModules = {};
|
||||
/******/
|
||||
/******/ // The require function
|
||||
/******/ function __webpack_require__(moduleId) {
|
||||
/******/
|
||||
/******/ // Check if module is in cache
|
||||
/******/ if(installedModules[moduleId]) {
|
||||
/******/ return installedModules[moduleId].exports;
|
||||
/******/ }
|
||||
/******/ // Create a new module (and put it into the cache)
|
||||
/******/ var module = installedModules[moduleId] = {
|
||||
/******/ i: moduleId,
|
||||
/******/ l: false,
|
||||
/******/ exports: {}
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // Execute the module function
|
||||
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
||||
/******/
|
||||
/******/ // Flag the module as loaded
|
||||
/******/ module.l = true;
|
||||
/******/
|
||||
/******/ // Return the exports of the module
|
||||
/******/ return module.exports;
|
||||
/******/ }
|
||||
/******/
|
||||
/******/
|
||||
/******/ // expose the modules object (__webpack_modules__)
|
||||
/******/ __webpack_require__.m = modules;
|
||||
/******/
|
||||
/******/ // expose the module cache
|
||||
/******/ __webpack_require__.c = installedModules;
|
||||
/******/
|
||||
/******/ // define getter function for harmony exports
|
||||
/******/ __webpack_require__.d = function(exports, name, getter) {
|
||||
/******/ if(!__webpack_require__.o(exports, name)) {
|
||||
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
|
||||
/******/ }
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // define __esModule on exports
|
||||
/******/ __webpack_require__.r = function(exports) {
|
||||
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
||||
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||
/******/ }
|
||||
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // create a fake namespace object
|
||||
/******/ // mode & 1: value is a module id, require it
|
||||
/******/ // mode & 2: merge all properties of value into the ns
|
||||
/******/ // mode & 4: return value when already ns object
|
||||
/******/ // mode & 8|1: behave like require
|
||||
/******/ __webpack_require__.t = function(value, mode) {
|
||||
/******/ if(mode & 1) value = __webpack_require__(value);
|
||||
/******/ if(mode & 8) return value;
|
||||
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
|
||||
/******/ var ns = Object.create(null);
|
||||
/******/ __webpack_require__.r(ns);
|
||||
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
|
||||
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
|
||||
/******/ return ns;
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
||||
/******/ __webpack_require__.n = function(module) {
|
||||
/******/ var getter = module && module.__esModule ?
|
||||
/******/ function getDefault() { return module['default']; } :
|
||||
/******/ function getModuleExports() { return module; };
|
||||
/******/ __webpack_require__.d(getter, 'a', getter);
|
||||
/******/ return getter;
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // Object.prototype.hasOwnProperty.call
|
||||
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
||||
/******/
|
||||
/******/ // __webpack_public_path__
|
||||
/******/ __webpack_require__.p = "";
|
||||
/******/
|
||||
/******/
|
||||
/******/ // Load entry module and return exports
|
||||
/******/ return __webpack_require__(__webpack_require__.s = 15);
|
||||
/******/ })
|
||||
/************************************************************************/
|
||||
/******/ ({
|
||||
|
||||
/***/ 15:
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
|
||||
Component({
|
||||
options: {
|
||||
addGlobalClass: true
|
||||
},
|
||||
properties: {
|
||||
extClass: {
|
||||
type: String,
|
||||
value: ''
|
||||
},
|
||||
content: {
|
||||
type: String,
|
||||
value: ''
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
/***/ })
|
||||
|
||||
/******/ });
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"component": true,
|
||||
"usingComponents": {}
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
<view class="weui-badge {{extClass}} {{!content ? 'weui-badge_dot' : ''}}">{{content}}</view>
|
||||
|
|
@ -0,0 +1 @@
|
|||
.weui-badge{display:inline-block;padding:.15em .4em;min-width:8px;border-radius:18px;background-color:#FA5151;color:#FFFFFF;line-height:1.2;text-align:center;font-size:12px;vertical-align:middle}.weui-badge_dot{padding:.4em;min-width:0}
|
||||
|
|
@ -0,0 +1,219 @@
|
|||
module.exports =
|
||||
/******/ (function(modules) { // webpackBootstrap
|
||||
/******/ // The module cache
|
||||
/******/ var installedModules = {};
|
||||
/******/
|
||||
/******/ // The require function
|
||||
/******/ function __webpack_require__(moduleId) {
|
||||
/******/
|
||||
/******/ // Check if module is in cache
|
||||
/******/ if(installedModules[moduleId]) {
|
||||
/******/ return installedModules[moduleId].exports;
|
||||
/******/ }
|
||||
/******/ // Create a new module (and put it into the cache)
|
||||
/******/ var module = installedModules[moduleId] = {
|
||||
/******/ i: moduleId,
|
||||
/******/ l: false,
|
||||
/******/ exports: {}
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // Execute the module function
|
||||
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
||||
/******/
|
||||
/******/ // Flag the module as loaded
|
||||
/******/ module.l = true;
|
||||
/******/
|
||||
/******/ // Return the exports of the module
|
||||
/******/ return module.exports;
|
||||
/******/ }
|
||||
/******/
|
||||
/******/
|
||||
/******/ // expose the modules object (__webpack_modules__)
|
||||
/******/ __webpack_require__.m = modules;
|
||||
/******/
|
||||
/******/ // expose the module cache
|
||||
/******/ __webpack_require__.c = installedModules;
|
||||
/******/
|
||||
/******/ // define getter function for harmony exports
|
||||
/******/ __webpack_require__.d = function(exports, name, getter) {
|
||||
/******/ if(!__webpack_require__.o(exports, name)) {
|
||||
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
|
||||
/******/ }
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // define __esModule on exports
|
||||
/******/ __webpack_require__.r = function(exports) {
|
||||
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
||||
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||
/******/ }
|
||||
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // create a fake namespace object
|
||||
/******/ // mode & 1: value is a module id, require it
|
||||
/******/ // mode & 2: merge all properties of value into the ns
|
||||
/******/ // mode & 4: return value when already ns object
|
||||
/******/ // mode & 8|1: behave like require
|
||||
/******/ __webpack_require__.t = function(value, mode) {
|
||||
/******/ if(mode & 1) value = __webpack_require__(value);
|
||||
/******/ if(mode & 8) return value;
|
||||
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
|
||||
/******/ var ns = Object.create(null);
|
||||
/******/ __webpack_require__.r(ns);
|
||||
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
|
||||
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
|
||||
/******/ return ns;
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
||||
/******/ __webpack_require__.n = function(module) {
|
||||
/******/ var getter = module && module.__esModule ?
|
||||
/******/ function getDefault() { return module['default']; } :
|
||||
/******/ function getModuleExports() { return module; };
|
||||
/******/ __webpack_require__.d(getter, 'a', getter);
|
||||
/******/ return getter;
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // Object.prototype.hasOwnProperty.call
|
||||
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
||||
/******/
|
||||
/******/ // __webpack_public_path__
|
||||
/******/ __webpack_require__.p = "";
|
||||
/******/
|
||||
/******/
|
||||
/******/ // Load entry module and return exports
|
||||
/******/ return __webpack_require__(__webpack_require__.s = 9);
|
||||
/******/ })
|
||||
/************************************************************************/
|
||||
/******/ ({
|
||||
|
||||
/***/ 9:
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
|
||||
Component({
|
||||
options: {
|
||||
addGlobalClass: true,
|
||||
multipleSlots: true
|
||||
},
|
||||
properties: {
|
||||
hover: {
|
||||
type: Boolean,
|
||||
value: false
|
||||
},
|
||||
link: {
|
||||
type: Boolean,
|
||||
value: false
|
||||
},
|
||||
extClass: {
|
||||
type: String,
|
||||
value: ''
|
||||
},
|
||||
iconClass: {
|
||||
type: String,
|
||||
value: ''
|
||||
},
|
||||
bodyClass: {
|
||||
type: String,
|
||||
value: ''
|
||||
},
|
||||
icon: {
|
||||
type: String,
|
||||
value: ''
|
||||
},
|
||||
title: {
|
||||
type: String,
|
||||
value: ''
|
||||
},
|
||||
value: {
|
||||
type: String,
|
||||
value: ''
|
||||
},
|
||||
showError: {
|
||||
type: Boolean,
|
||||
value: false
|
||||
},
|
||||
prop: {
|
||||
type: String,
|
||||
value: ''
|
||||
},
|
||||
url: {
|
||||
type: String,
|
||||
value: ''
|
||||
},
|
||||
footerClass: {
|
||||
type: String,
|
||||
value: ''
|
||||
},
|
||||
footer: {
|
||||
type: String,
|
||||
value: ''
|
||||
},
|
||||
inline: {
|
||||
type: Boolean,
|
||||
value: true
|
||||
},
|
||||
hasHeader: {
|
||||
type: Boolean,
|
||||
value: true
|
||||
},
|
||||
hasFooter: {
|
||||
type: Boolean,
|
||||
value: true
|
||||
},
|
||||
hasBody: {
|
||||
type: Boolean,
|
||||
value: true
|
||||
}
|
||||
},
|
||||
relations: {
|
||||
'../form/form': {
|
||||
type: 'ancestor'
|
||||
},
|
||||
'../cells/cells': {
|
||||
type: 'ancestor'
|
||||
}
|
||||
},
|
||||
data: {
|
||||
inForm: false
|
||||
},
|
||||
methods: {
|
||||
setError: function setError(error) {
|
||||
this.setData({
|
||||
error: error || false
|
||||
});
|
||||
},
|
||||
setInForm: function setInForm() {
|
||||
this.setData({
|
||||
inForm: true
|
||||
});
|
||||
},
|
||||
setOuterClass: function setOuterClass(className) {
|
||||
this.setData({
|
||||
outerClass: className
|
||||
});
|
||||
},
|
||||
navigateTo: function navigateTo() {
|
||||
var _this = this;
|
||||
|
||||
var data = this.data;
|
||||
if (data.url && data.link) {
|
||||
wx.navigateTo({
|
||||
url: data.url,
|
||||
success: function success(res) {
|
||||
_this.triggerEvent('navigatesuccess', res, {});
|
||||
},
|
||||
fail: function fail(_fail) {
|
||||
_this.triggerEvent('navigateerror', _fail, {});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
/***/ })
|
||||
|
||||
/******/ });
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"mp-cells": "../cells/cells"
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,73 @@
|
|||
<block wx:if="{{link}}">
|
||||
<view bindtap="navigateTo" class="weui-cell weui-cell_access {{extClass}} {{outerClass}}{{inForm ? ' weui-cell-inform' : ''}}{{inline ? '' : ' .weui-cell_label-block'}}" hover-class="{{hover ? 'weui-cell_active' : ''}}">
|
||||
<view wx:if="{{hasHeader}}" class="weui-cell__hd {{iconClass}}">
|
||||
<block wx:if="{{icon}}">
|
||||
<image src="{{icon}}" class="weui-cell__icon" mode="aspectFit"></image>
|
||||
</block>
|
||||
<block wx:else>
|
||||
<slot name="icon"></slot>
|
||||
</block>
|
||||
<block wx:if="{{inForm}}">
|
||||
<block wx:if="{{title}}"><view class="weui-label">{{title}}</view></block>
|
||||
<block wx:else>
|
||||
<slot name="title"></slot>
|
||||
</block>
|
||||
</block>
|
||||
<block wx:else>
|
||||
<block wx:if="{{title}}">{{title}}</block>
|
||||
<block wx:else>
|
||||
<slot name="title"></slot>
|
||||
</block>
|
||||
</block>
|
||||
</view>
|
||||
<view wx:if="{{hasBody}}" class="weui-cell__bd">
|
||||
<block wx:if="{{value}}">{{value}}</block>
|
||||
<block wx:else>
|
||||
<slot></slot>
|
||||
</block>
|
||||
</view>
|
||||
<view wx:if="{{hasFooter}}" class="weui-cell__ft weui-cell__ft_in-access {{footerClass}}">
|
||||
<block wx:if="{{footer}}">{{footer}}</block>
|
||||
<block wx:else>
|
||||
<slot name="footer"></slot>
|
||||
</block>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
<block wx:else>
|
||||
<view bindtap="navigateTo" class="weui-cell {{showError && error ? 'weui-cell_warn' : ''}} {{inForm ? 'weui-cell-inform' : ''}} {{extClass}} {{outerClass}}" hover-class="{{hover ? 'weui-cell_active' : ''}}">
|
||||
<view wx:if="{{hasHeader}}" class="weui-cell__hd {{iconClass}}">
|
||||
<block wx:if="{{icon}}">
|
||||
<image src="{{icon}}" class="weui-cell__icon" mode="aspectFit"></image>
|
||||
</block>
|
||||
<block wx:else>
|
||||
<slot name="icon"></slot>
|
||||
</block>
|
||||
<block wx:if="{{inForm}}">
|
||||
<block wx:if="{{title}}"><view class="weui-label">{{title}}</view></block>
|
||||
<block wx:else>
|
||||
<slot name="title"></slot>
|
||||
</block>
|
||||
</block>
|
||||
<block wx:else>
|
||||
<block wx:if="{{title}}">{{title}}</block>
|
||||
<block wx:else>
|
||||
<slot name="title"></slot>
|
||||
</block>
|
||||
</block>
|
||||
</view>
|
||||
<view wx:if="{{hasBody}}" class="weui-cell__bd {{bodyClass}}">
|
||||
<block wx:if="{{value}}">{{value}}</block>
|
||||
<block wx:else>
|
||||
<slot></slot>
|
||||
</block>
|
||||
</view>
|
||||
<view wx:if="{{hasFooter}}" class="weui-cell__ft {{footerClass}}">
|
||||
<block wx:if="{{footer}}">{{footer}}</block>
|
||||
<block wx:else>
|
||||
<slot name="footer"></slot>
|
||||
</block>
|
||||
<icon wx:if="{{showError && error}}" type="warn" size="23" color="#E64340"></icon>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
|
|
@ -0,0 +1 @@
|
|||
.weui-cells{position:relative;margin-top:8px;background-color:#FFFFFF;line-height:1.41176471;font-size:17px}.weui-cells:before{content:" ";position:absolute;left:0;top:0;right:0;height:1px;border-top:1rpx solid rgba(0,0,0,0.1);color:rgba(0,0,0,0.1)}.weui-cells:after{content:" ";position:absolute;left:0;bottom:0;right:0;height:1px;border-bottom:1rpx solid rgba(0,0,0,0.1);color:rgba(0,0,0,0.1)}.weui-cells__title{margin-top:16px;margin-bottom:3px;padding-left:16px;padding-right:16px;color:rgba(0,0,0,0.5);font-size:14px}.weui-cells_after-title{margin-top:0}.weui-cells__tips{margin-top:3px;color:rgba(0,0,0,0.5);padding-left:16px;padding-right:16px;font-size:14px}.weui-cell{padding:16px;position:relative;display:flex;align-items:center}.weui-cell:before{content:" ";position:absolute;left:0;top:0;right:0;height:1px;border-top:1rpx solid rgba(0,0,0,0.1);color:rgba(0,0,0,0.1);left:16px}.weui-cell:first-child:before{display:none}.weui-cell_active{background-color:#ECECEC}.weui-cell_primary{align-items:flex-start}.weui-cell__bd{flex:1}.weui-cell__ft{text-align:right;color:rgba(0,0,0,0.5)}.weui-cell_wxss.weui-cell_wxss:before{display:block}.weui-cell_label-block{display:block}.weui-cell_label-block .weui-label{width:auto;word-break:initial;-webkit-hyphens:auto;hyphens:auto}.weui-cell_vcode{padding-top:0;padding-right:0;padding-bottom:0}.weui-vcode-img{margin-left:5px;height:3.29411765em;vertical-align:middle}.weui-vcode-btn{display:inline-block;height:3.29411765em;margin-left:5px;padding:0 .6em 0 .7em;border-left:1rpx solid rgba(0,0,0,0.1);line-height:3.29411765em;vertical-align:middle;font-size:17px;color:#576B95;white-space:nowrap}button.weui-vcode-btn{min-height:0;background-color:transparent;border:0;outline:0}.weui-vcode-btn:active{color:#767676}
|
||||
|
|
@ -0,0 +1,174 @@
|
|||
module.exports =
|
||||
/******/ (function(modules) { // webpackBootstrap
|
||||
/******/ // The module cache
|
||||
/******/ var installedModules = {};
|
||||
/******/
|
||||
/******/ // The require function
|
||||
/******/ function __webpack_require__(moduleId) {
|
||||
/******/
|
||||
/******/ // Check if module is in cache
|
||||
/******/ if(installedModules[moduleId]) {
|
||||
/******/ return installedModules[moduleId].exports;
|
||||
/******/ }
|
||||
/******/ // Create a new module (and put it into the cache)
|
||||
/******/ var module = installedModules[moduleId] = {
|
||||
/******/ i: moduleId,
|
||||
/******/ l: false,
|
||||
/******/ exports: {}
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // Execute the module function
|
||||
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
||||
/******/
|
||||
/******/ // Flag the module as loaded
|
||||
/******/ module.l = true;
|
||||
/******/
|
||||
/******/ // Return the exports of the module
|
||||
/******/ return module.exports;
|
||||
/******/ }
|
||||
/******/
|
||||
/******/
|
||||
/******/ // expose the modules object (__webpack_modules__)
|
||||
/******/ __webpack_require__.m = modules;
|
||||
/******/
|
||||
/******/ // expose the module cache
|
||||
/******/ __webpack_require__.c = installedModules;
|
||||
/******/
|
||||
/******/ // define getter function for harmony exports
|
||||
/******/ __webpack_require__.d = function(exports, name, getter) {
|
||||
/******/ if(!__webpack_require__.o(exports, name)) {
|
||||
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
|
||||
/******/ }
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // define __esModule on exports
|
||||
/******/ __webpack_require__.r = function(exports) {
|
||||
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
||||
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||
/******/ }
|
||||
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // create a fake namespace object
|
||||
/******/ // mode & 1: value is a module id, require it
|
||||
/******/ // mode & 2: merge all properties of value into the ns
|
||||
/******/ // mode & 4: return value when already ns object
|
||||
/******/ // mode & 8|1: behave like require
|
||||
/******/ __webpack_require__.t = function(value, mode) {
|
||||
/******/ if(mode & 1) value = __webpack_require__(value);
|
||||
/******/ if(mode & 8) return value;
|
||||
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
|
||||
/******/ var ns = Object.create(null);
|
||||
/******/ __webpack_require__.r(ns);
|
||||
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
|
||||
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
|
||||
/******/ return ns;
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
||||
/******/ __webpack_require__.n = function(module) {
|
||||
/******/ var getter = module && module.__esModule ?
|
||||
/******/ function getDefault() { return module['default']; } :
|
||||
/******/ function getModuleExports() { return module; };
|
||||
/******/ __webpack_require__.d(getter, 'a', getter);
|
||||
/******/ return getter;
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // Object.prototype.hasOwnProperty.call
|
||||
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
||||
/******/
|
||||
/******/ // __webpack_public_path__
|
||||
/******/ __webpack_require__.p = "";
|
||||
/******/
|
||||
/******/
|
||||
/******/ // Load entry module and return exports
|
||||
/******/ return __webpack_require__(__webpack_require__.s = 8);
|
||||
/******/ })
|
||||
/************************************************************************/
|
||||
/******/ ({
|
||||
|
||||
/***/ 8:
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
|
||||
Component({
|
||||
options: {
|
||||
addGlobalClass: true,
|
||||
multipleSlots: true
|
||||
},
|
||||
properties: {
|
||||
title: {
|
||||
type: String,
|
||||
value: ''
|
||||
},
|
||||
extClass: {
|
||||
type: String,
|
||||
value: ''
|
||||
},
|
||||
footer: {
|
||||
type: String,
|
||||
value: ''
|
||||
}
|
||||
},
|
||||
data: {
|
||||
firstItem: null,
|
||||
checkboxCount: 0,
|
||||
checkboxIsMulti: false,
|
||||
outerClass: '',
|
||||
childClass: ''
|
||||
},
|
||||
relations: {
|
||||
'../cell/cell': {
|
||||
type: 'descendant',
|
||||
linked: function linked(target) {
|
||||
if (!this.data.firstItem) {
|
||||
this.data.firstItem = target;
|
||||
}
|
||||
if (target !== this.data.firstItem) {
|
||||
target.setOuterClass('weui-cell_wxss');
|
||||
}
|
||||
}
|
||||
},
|
||||
'../form-page/form-page': {
|
||||
type: 'ancestor'
|
||||
},
|
||||
'../checkbox-group/checkbox-group': {
|
||||
type: 'descendant',
|
||||
linked: function linked(target) {
|
||||
this.setData({
|
||||
checkboxCount: this.data.checkboxCount + 1,
|
||||
checkboxIsMulti: target.data.multi
|
||||
});
|
||||
},
|
||||
unlinked: function unlinked(target) {
|
||||
this.setData({
|
||||
checkboxCount: this.data.checkboxCount - 1,
|
||||
checkboxIsMulti: target.data.multi
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
setCellMulti: function setCellMulti(multi) {
|
||||
this.setData({
|
||||
checkboxIsMulti: multi
|
||||
});
|
||||
},
|
||||
setCellsClass: function setCellsClass(className) {
|
||||
this.setData({
|
||||
childClass: className
|
||||
});
|
||||
},
|
||||
setOuterClass: function setOuterClass(className) {
|
||||
this.setData({
|
||||
outerClass: className
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
/***/ })
|
||||
|
||||
/******/ });
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"component": true,
|
||||
"usingComponents": {}
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
<view class="{{extClass}} weui-cells__group {{outerClass}} {{childClass}}">
|
||||
<view wx:if="{{title}}" class="weui-cells__title">{{title}}</view>
|
||||
<view class="weui-cells weui-cells_after-title weui-cells_form {{checkboxCount > 0 && checkboxIsMulti ? 'weui-cells_checkbox' : ''}}">
|
||||
<slot></slot>
|
||||
</view>
|
||||
<view wx:if="{{footer}}" class="weui-cells__tips">{{footer}}</view>
|
||||
<slot name="footer" wx:else></slot>
|
||||
</view>
|
||||
|
|
@ -0,0 +1,203 @@
|
|||
module.exports =
|
||||
/******/ (function(modules) { // webpackBootstrap
|
||||
/******/ // The module cache
|
||||
/******/ var installedModules = {};
|
||||
/******/
|
||||
/******/ // The require function
|
||||
/******/ function __webpack_require__(moduleId) {
|
||||
/******/
|
||||
/******/ // Check if module is in cache
|
||||
/******/ if(installedModules[moduleId]) {
|
||||
/******/ return installedModules[moduleId].exports;
|
||||
/******/ }
|
||||
/******/ // Create a new module (and put it into the cache)
|
||||
/******/ var module = installedModules[moduleId] = {
|
||||
/******/ i: moduleId,
|
||||
/******/ l: false,
|
||||
/******/ exports: {}
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // Execute the module function
|
||||
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
||||
/******/
|
||||
/******/ // Flag the module as loaded
|
||||
/******/ module.l = true;
|
||||
/******/
|
||||
/******/ // Return the exports of the module
|
||||
/******/ return module.exports;
|
||||
/******/ }
|
||||
/******/
|
||||
/******/
|
||||
/******/ // expose the modules object (__webpack_modules__)
|
||||
/******/ __webpack_require__.m = modules;
|
||||
/******/
|
||||
/******/ // expose the module cache
|
||||
/******/ __webpack_require__.c = installedModules;
|
||||
/******/
|
||||
/******/ // define getter function for harmony exports
|
||||
/******/ __webpack_require__.d = function(exports, name, getter) {
|
||||
/******/ if(!__webpack_require__.o(exports, name)) {
|
||||
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
|
||||
/******/ }
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // define __esModule on exports
|
||||
/******/ __webpack_require__.r = function(exports) {
|
||||
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
||||
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||
/******/ }
|
||||
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // create a fake namespace object
|
||||
/******/ // mode & 1: value is a module id, require it
|
||||
/******/ // mode & 2: merge all properties of value into the ns
|
||||
/******/ // mode & 4: return value when already ns object
|
||||
/******/ // mode & 8|1: behave like require
|
||||
/******/ __webpack_require__.t = function(value, mode) {
|
||||
/******/ if(mode & 1) value = __webpack_require__(value);
|
||||
/******/ if(mode & 8) return value;
|
||||
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
|
||||
/******/ var ns = Object.create(null);
|
||||
/******/ __webpack_require__.r(ns);
|
||||
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
|
||||
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
|
||||
/******/ return ns;
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
||||
/******/ __webpack_require__.n = function(module) {
|
||||
/******/ var getter = module && module.__esModule ?
|
||||
/******/ function getDefault() { return module['default']; } :
|
||||
/******/ function getModuleExports() { return module; };
|
||||
/******/ __webpack_require__.d(getter, 'a', getter);
|
||||
/******/ return getter;
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // Object.prototype.hasOwnProperty.call
|
||||
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
||||
/******/
|
||||
/******/ // __webpack_public_path__
|
||||
/******/ __webpack_require__.p = "";
|
||||
/******/
|
||||
/******/
|
||||
/******/ // Load entry module and return exports
|
||||
/******/ return __webpack_require__(__webpack_require__.s = 23);
|
||||
/******/ })
|
||||
/************************************************************************/
|
||||
/******/ ({
|
||||
|
||||
/***/ 23:
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
|
||||
Component({
|
||||
properties: {
|
||||
multi: {
|
||||
type: Boolean,
|
||||
value: true,
|
||||
observer: '_multiChange'
|
||||
},
|
||||
extClass: {
|
||||
type: String,
|
||||
value: ''
|
||||
},
|
||||
prop: {
|
||||
type: String,
|
||||
value: ''
|
||||
}
|
||||
},
|
||||
data: {
|
||||
targetList: [],
|
||||
parentCell: null
|
||||
},
|
||||
relations: {
|
||||
'../checkbox/checkbox': {
|
||||
type: 'descendant',
|
||||
linked: function linked(target) {
|
||||
this.data.targetList.push(target);
|
||||
target.setMulti(this.data.multi);
|
||||
if (!this.data.firstItem) {
|
||||
this.data.firstItem = target;
|
||||
}
|
||||
if (target !== this.data.firstItem) {
|
||||
target.setOuterClass('weui-cell_wxss');
|
||||
}
|
||||
},
|
||||
unlinked: function unlinked(target) {
|
||||
var index = -1;
|
||||
this.data.targetList.forEach(function (item, idx) {
|
||||
if (item === target) {
|
||||
index = idx;
|
||||
}
|
||||
});
|
||||
this.data.targetList.splice(index, 1);
|
||||
if (!this.data.targetList) {
|
||||
this.data.firstItem = null;
|
||||
}
|
||||
}
|
||||
},
|
||||
'../form/form': {
|
||||
type: 'ancestor'
|
||||
},
|
||||
'../cells/cells': {
|
||||
type: 'ancestor',
|
||||
linked: function linked(target) {
|
||||
if (!this.data.parentCell) {
|
||||
this.data.parentCell = target;
|
||||
}
|
||||
this.setParentCellsClass();
|
||||
},
|
||||
unlinked: function unlinked(target) {
|
||||
this.data.parentCell = null;
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
checkedChange: function checkedChange(checked, target) {
|
||||
console.log('checked change', checked);
|
||||
if (this.data.multi) {
|
||||
var vals = [];
|
||||
this.data.targetList.forEach(function (item) {
|
||||
if (item.data.checked) {
|
||||
vals.push(item.data.value);
|
||||
}
|
||||
});
|
||||
this.triggerEvent('change', { value: vals });
|
||||
} else {
|
||||
var val = '';
|
||||
this.data.targetList.forEach(function (item) {
|
||||
if (item === target) {
|
||||
val = item.data.value;
|
||||
} else {
|
||||
item.setData({
|
||||
checked: false
|
||||
});
|
||||
}
|
||||
});
|
||||
this.triggerEvent('change', { value: val }, {});
|
||||
}
|
||||
},
|
||||
setParentCellsClass: function setParentCellsClass() {
|
||||
var className = this.data.multi ? 'weui-cells_checkbox' : '';
|
||||
if (this.data.parentCell) {
|
||||
this.data.parentCell.setCellsClass(className);
|
||||
}
|
||||
},
|
||||
_multiChange: function _multiChange(multi) {
|
||||
this.data.targetList.forEach(function (target) {
|
||||
target.setMulti(multi);
|
||||
});
|
||||
if (this.data.parentCell) {
|
||||
this.data.parentCell.setCellMulti(multi);
|
||||
}
|
||||
return multi;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
/***/ })
|
||||
|
||||
/******/ });
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"mp-cells": "../cells/cells"
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
<checkbox-group class="{{extClass}}" wx-if="{{multi}}" bindchange="checkedChange">
|
||||
<slot></slot>
|
||||
</checkbox-group>
|
||||
<radio-group class="{{extClass}}" wx-else bindchange="checkedChange">
|
||||
<slot></slot>
|
||||
</radio-group>
|
||||
|
|
@ -0,0 +1,172 @@
|
|||
module.exports =
|
||||
/******/ (function(modules) { // webpackBootstrap
|
||||
/******/ // The module cache
|
||||
/******/ var installedModules = {};
|
||||
/******/
|
||||
/******/ // The require function
|
||||
/******/ function __webpack_require__(moduleId) {
|
||||
/******/
|
||||
/******/ // Check if module is in cache
|
||||
/******/ if(installedModules[moduleId]) {
|
||||
/******/ return installedModules[moduleId].exports;
|
||||
/******/ }
|
||||
/******/ // Create a new module (and put it into the cache)
|
||||
/******/ var module = installedModules[moduleId] = {
|
||||
/******/ i: moduleId,
|
||||
/******/ l: false,
|
||||
/******/ exports: {}
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // Execute the module function
|
||||
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
||||
/******/
|
||||
/******/ // Flag the module as loaded
|
||||
/******/ module.l = true;
|
||||
/******/
|
||||
/******/ // Return the exports of the module
|
||||
/******/ return module.exports;
|
||||
/******/ }
|
||||
/******/
|
||||
/******/
|
||||
/******/ // expose the modules object (__webpack_modules__)
|
||||
/******/ __webpack_require__.m = modules;
|
||||
/******/
|
||||
/******/ // expose the module cache
|
||||
/******/ __webpack_require__.c = installedModules;
|
||||
/******/
|
||||
/******/ // define getter function for harmony exports
|
||||
/******/ __webpack_require__.d = function(exports, name, getter) {
|
||||
/******/ if(!__webpack_require__.o(exports, name)) {
|
||||
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
|
||||
/******/ }
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // define __esModule on exports
|
||||
/******/ __webpack_require__.r = function(exports) {
|
||||
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
||||
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||
/******/ }
|
||||
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // create a fake namespace object
|
||||
/******/ // mode & 1: value is a module id, require it
|
||||
/******/ // mode & 2: merge all properties of value into the ns
|
||||
/******/ // mode & 4: return value when already ns object
|
||||
/******/ // mode & 8|1: behave like require
|
||||
/******/ __webpack_require__.t = function(value, mode) {
|
||||
/******/ if(mode & 1) value = __webpack_require__(value);
|
||||
/******/ if(mode & 8) return value;
|
||||
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
|
||||
/******/ var ns = Object.create(null);
|
||||
/******/ __webpack_require__.r(ns);
|
||||
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
|
||||
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
|
||||
/******/ return ns;
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
||||
/******/ __webpack_require__.n = function(module) {
|
||||
/******/ var getter = module && module.__esModule ?
|
||||
/******/ function getDefault() { return module['default']; } :
|
||||
/******/ function getModuleExports() { return module; };
|
||||
/******/ __webpack_require__.d(getter, 'a', getter);
|
||||
/******/ return getter;
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // Object.prototype.hasOwnProperty.call
|
||||
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
||||
/******/
|
||||
/******/ // __webpack_public_path__
|
||||
/******/ __webpack_require__.p = "";
|
||||
/******/
|
||||
/******/
|
||||
/******/ // Load entry module and return exports
|
||||
/******/ return __webpack_require__(__webpack_require__.s = 24);
|
||||
/******/ })
|
||||
/************************************************************************/
|
||||
/******/ ({
|
||||
|
||||
/***/ 24:
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
|
||||
Component({
|
||||
options: {
|
||||
addGlobalClass: true,
|
||||
multipleSlots: true
|
||||
},
|
||||
properties: {
|
||||
multi: {
|
||||
type: Boolean,
|
||||
value: true
|
||||
},
|
||||
checked: {
|
||||
type: Boolean,
|
||||
value: false
|
||||
},
|
||||
value: {
|
||||
type: String,
|
||||
value: ''
|
||||
},
|
||||
label: {
|
||||
type: String,
|
||||
value: 'label'
|
||||
},
|
||||
extClass: {
|
||||
type: String,
|
||||
value: ''
|
||||
}
|
||||
},
|
||||
data: {},
|
||||
relations: {
|
||||
'../checkbox-group/checkbox-group': {
|
||||
type: 'ancestor',
|
||||
linked: function linked(target) {
|
||||
this.data.group = target;
|
||||
},
|
||||
unlinked: function unlinked() {
|
||||
this.data.group = null;
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
setMulti: function setMulti(multi) {
|
||||
this.setData({
|
||||
multi: multi
|
||||
});
|
||||
},
|
||||
setOuterClass: function setOuterClass(className) {
|
||||
this.setData({
|
||||
outerClass: className
|
||||
});
|
||||
},
|
||||
checkedChange: function checkedChange(e) {
|
||||
if (this.data.multi) {
|
||||
var checked = !this.data.checked;
|
||||
this.setData({
|
||||
checked: checked
|
||||
});
|
||||
if (this.data.group) {
|
||||
this.data.group.checkedChange(checked, this);
|
||||
}
|
||||
} else {
|
||||
var _checked = this.data.checked;
|
||||
if (_checked) return;
|
||||
this.setData({
|
||||
checked: true
|
||||
});
|
||||
if (this.data.group) {
|
||||
this.data.group.checkedChange(_checked, this);
|
||||
}
|
||||
}
|
||||
this.triggerEvent('change', { value: this.data.value, checked: this.data.checked });
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
/***/ })
|
||||
|
||||
/******/ });
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"mp-cell": "../cell/cell",
|
||||
"mp-checkbox-group": "../checkbox-group/checkbox-group"
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
<mp-cell has-footer="{{!multi}}" has-header="{{multi}}" bindtap="checkedChange" footer-class="{{!multi ? 'weui-check__ft_in-radio' : ''}}" icon-class="{{multi ? 'weui-check__hd_in-checkbox' : ''}}" ext-class="weui-check__label {{outerClass}} {{extClass}} {{!multi ? 'weui-cell_radio' : 'weui-cell_checkbox'}}">
|
||||
|
||||
<view slot="icon" wx:if="{{multi}}">
|
||||
<checkbox value="{{value}}" checked="{{checked}}" disabled="{{disabled}}" color="{{color}}" class="weui-check"></checkbox>
|
||||
<!-- 未勾选 -->
|
||||
<icon wx:if="{{!checked}}" size="23" class="weui-icon-checkbox_circle" type="circle"></icon>
|
||||
<icon wx:else size="23" class="weui-icon-checkbox_success" type="success"></icon>
|
||||
</view>
|
||||
<view>{{label}}</view>
|
||||
<view slot="footer" wx:if="{{!multi}}">
|
||||
<radio value="{{value}}" checked="{{checked}}" disabled="{{disabled}}" color="{{color}}" class="weui-check"></radio>
|
||||
<!-- 已勾选 -->
|
||||
<icon size="16" wx:if="{{checked}}" class="weui-icon-radio" type="success_no_circle"></icon>
|
||||
</view>
|
||||
</mp-cell>
|
||||
|
|
@ -0,0 +1 @@
|
|||
.weui-cells_checkbox .weui-check__label:before{left:55px}.weui-check__label:active{background-color:#ECECEC}.weui-check{position:absolute;left:-9999px}.weui-check__hd_in-checkbox{padding-right:16px}.weui-cell__ft_in-radio{padding-left:16px}
|
||||
|
|
@ -0,0 +1,168 @@
|
|||
module.exports =
|
||||
/******/ (function(modules) { // webpackBootstrap
|
||||
/******/ // The module cache
|
||||
/******/ var installedModules = {};
|
||||
/******/
|
||||
/******/ // The require function
|
||||
/******/ function __webpack_require__(moduleId) {
|
||||
/******/
|
||||
/******/ // Check if module is in cache
|
||||
/******/ if(installedModules[moduleId]) {
|
||||
/******/ return installedModules[moduleId].exports;
|
||||
/******/ }
|
||||
/******/ // Create a new module (and put it into the cache)
|
||||
/******/ var module = installedModules[moduleId] = {
|
||||
/******/ i: moduleId,
|
||||
/******/ l: false,
|
||||
/******/ exports: {}
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // Execute the module function
|
||||
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
||||
/******/
|
||||
/******/ // Flag the module as loaded
|
||||
/******/ module.l = true;
|
||||
/******/
|
||||
/******/ // Return the exports of the module
|
||||
/******/ return module.exports;
|
||||
/******/ }
|
||||
/******/
|
||||
/******/
|
||||
/******/ // expose the modules object (__webpack_modules__)
|
||||
/******/ __webpack_require__.m = modules;
|
||||
/******/
|
||||
/******/ // expose the module cache
|
||||
/******/ __webpack_require__.c = installedModules;
|
||||
/******/
|
||||
/******/ // define getter function for harmony exports
|
||||
/******/ __webpack_require__.d = function(exports, name, getter) {
|
||||
/******/ if(!__webpack_require__.o(exports, name)) {
|
||||
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
|
||||
/******/ }
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // define __esModule on exports
|
||||
/******/ __webpack_require__.r = function(exports) {
|
||||
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
||||
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||
/******/ }
|
||||
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // create a fake namespace object
|
||||
/******/ // mode & 1: value is a module id, require it
|
||||
/******/ // mode & 2: merge all properties of value into the ns
|
||||
/******/ // mode & 4: return value when already ns object
|
||||
/******/ // mode & 8|1: behave like require
|
||||
/******/ __webpack_require__.t = function(value, mode) {
|
||||
/******/ if(mode & 1) value = __webpack_require__(value);
|
||||
/******/ if(mode & 8) return value;
|
||||
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
|
||||
/******/ var ns = Object.create(null);
|
||||
/******/ __webpack_require__.r(ns);
|
||||
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
|
||||
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
|
||||
/******/ return ns;
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
||||
/******/ __webpack_require__.n = function(module) {
|
||||
/******/ var getter = module && module.__esModule ?
|
||||
/******/ function getDefault() { return module['default']; } :
|
||||
/******/ function getModuleExports() { return module; };
|
||||
/******/ __webpack_require__.d(getter, 'a', getter);
|
||||
/******/ return getter;
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // Object.prototype.hasOwnProperty.call
|
||||
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
||||
/******/
|
||||
/******/ // __webpack_public_path__
|
||||
/******/ __webpack_require__.p = "";
|
||||
/******/
|
||||
/******/
|
||||
/******/ // Load entry module and return exports
|
||||
/******/ return __webpack_require__(__webpack_require__.s = 20);
|
||||
/******/ })
|
||||
/************************************************************************/
|
||||
/******/ ({
|
||||
|
||||
/***/ 20:
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
|
||||
Component({
|
||||
options: {
|
||||
multipleSlots: true,
|
||||
addGlobalClass: true
|
||||
},
|
||||
properties: {
|
||||
title: {
|
||||
type: String,
|
||||
value: ''
|
||||
},
|
||||
extClass: {
|
||||
type: String,
|
||||
value: ''
|
||||
},
|
||||
maskClosable: {
|
||||
type: Boolean,
|
||||
value: true
|
||||
},
|
||||
mask: {
|
||||
type: Boolean,
|
||||
value: true
|
||||
},
|
||||
show: {
|
||||
type: Boolean,
|
||||
value: false,
|
||||
observer: '_showChange'
|
||||
},
|
||||
buttons: {
|
||||
type: Array,
|
||||
value: []
|
||||
}
|
||||
},
|
||||
data: {
|
||||
innerShow: false
|
||||
},
|
||||
ready: function ready() {
|
||||
var buttons = this.data.buttons;
|
||||
var len = buttons.length;
|
||||
buttons.forEach(function (btn, index) {
|
||||
if (len === 1) {
|
||||
btn.className = 'weui-dialog__btn_primary';
|
||||
} else if (index === 0) {
|
||||
btn.className = 'weui-dialog__btn_default';
|
||||
} else {
|
||||
btn.className = 'weui-dialog__btn_primary';
|
||||
}
|
||||
});
|
||||
this.setData({
|
||||
buttons: buttons
|
||||
});
|
||||
},
|
||||
|
||||
methods: {
|
||||
buttonTap: function buttonTap(e) {
|
||||
var index = e.currentTarget.dataset.index;
|
||||
|
||||
this.triggerEvent('buttontap', { index: index, item: this.data.buttons[index] }, {});
|
||||
},
|
||||
close: function close() {
|
||||
var data = this.data;
|
||||
if (!data.maskClosable) return;
|
||||
this.setData({
|
||||
show: false
|
||||
});
|
||||
this.triggerEvent('close', {}, {});
|
||||
},
|
||||
stopEvent: function stopEvent() {}
|
||||
}
|
||||
});
|
||||
|
||||
/***/ })
|
||||
|
||||
/******/ });
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"component": true,
|
||||
"usingComponents": {}
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
<view bindtap="close" class="weui-mask {{!show ? 'weui-mask_hidden' : '' }}" wx:if="{{mask}}"></view>
|
||||
<view wx:if="{{show}}" bindtap="close" class="weui-dialog__wrp {{extClass}}">
|
||||
<view class="weui-dialog" catchtap="stopEvent">
|
||||
<view class="weui-dialog__hd">
|
||||
<view class="weui-dialog__title">{{title}}
|
||||
<slot name="title"></slot>
|
||||
</view>
|
||||
</view>
|
||||
<view class="weui-dialog__bd">
|
||||
<slot></slot>
|
||||
</view>
|
||||
<view class="weui-dialog__ft">
|
||||
<block wx:if="{{buttons && buttons.length}}">
|
||||
<view wx:for="{{buttons}}" class="weui-dialog__btn {{item.className}} {{item.extClass}}" data-index="{{index}}" bindtap="buttonTap">{{item.text}}</view>
|
||||
<!-- <view class="weui-dialog__btn" bindtap="confirm">确认</view> -->
|
||||
</block>
|
||||
<slot name="footer" wx:else></slot>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
|
@ -0,0 +1 @@
|
|||
.weui-mask{position:fixed;z-index:1000;top:0;right:0;left:0;bottom:0;background:rgba(0,0,0,0.6)}.weui-mask_transparent{position:fixed;z-index:1000;top:0;right:0;left:0;bottom:0}.weui-dialog__wrp{position:fixed;z-index:5000;top:16px;bottom:16px;left:16px;right:16px;text-align:center;font-size:0;display:-webkit-box;display:-webkit-flex;display:flex;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;justify-content:center}.weui-dialog__wrp .weui-dialog{max-height:100%}.weui-dialog{background-color:#FFFFFF;text-align:center;border-radius:12px;overflow:hidden;display:-webkit-box;display:-webkit-flex;display:flex;-webkit-flex-direction:column;flex-direction:column;max-height:90%}.weui-dialog__hd{padding:32px 24px 16px}.weui-dialog__title{font-weight:700;font-size:17px;line-height:1.4}.weui-dialog__bd{flex:1;overflow-y:auto;-webkit-overflow-scrolling:touch;padding:0 24px;margin-bottom:32px;min-height:40px;font-size:17px;line-height:1.4;overflow-wrap:break-word;-webkit-hyphens:auto;hyphens:auto;color:rgba(0,0,0,0.5)}.weui-dialog__bd:first-child{padding:32px 24px 0;font-weight:700;color:rgba(0,0,0,0.9);display:-webkit-box;display:-webkit-flex;display:flex;-webkit-flex-direction:column;flex-direction:column;-webkit-box-pack:center;-webkit-justify-content:center;justify-content:center}.weui-dialog__ft{position:relative;line-height:64px;min-height:64px;font-size:17px;display:flex}.weui-dialog__ft:after{content:" ";position:absolute;left:0;top:0;right:0;height:1px;border-top:1rpx solid rgba(0,0,0,0.1);color:rgba(0,0,0,0.1)}.weui-dialog__btn{display:block;flex:1;color:#576B95;font-weight:700;text-decoration:none;-webkit-tap-highlight-color:rgba(0,0,0,0);position:relative}.weui-dialog__btn:active{background-color:#ECECEC}.weui-dialog__btn:after{content:" ";position:absolute;left:0;top:0;width:1px;bottom:0;border-left:1rpx solid rgba(0,0,0,0.1);color:rgba(0,0,0,0.1)}.weui-dialog__btn:first-child:after{display:none}.weui-dialog__btn_default{color:rgba(0,0,0,0.9)}@media screen and (min-width:352px){.weui-dialog{width:320px;margin:0 auto}}.weui-dialog.weui-dialog_hidden{opacity:0;transform:scale3d(1, 1, 0)}.weui-dialog{opacity:1;-webkit-transform:scale3d(1, 1, 1);transform:scale3d(1, 1, 1);transition:all .3s ease-in}.weui-mask.weui-mask_hidden{opacity:0;transform:scale3d(1, 1, 0)}.weui-mask{opacity:1;transform:scale3d(1, 1, 1);transition:all .3s ease-in}
|
||||
|
|
@ -0,0 +1,131 @@
|
|||
module.exports =
|
||||
/******/ (function(modules) { // webpackBootstrap
|
||||
/******/ // The module cache
|
||||
/******/ var installedModules = {};
|
||||
/******/
|
||||
/******/ // The require function
|
||||
/******/ function __webpack_require__(moduleId) {
|
||||
/******/
|
||||
/******/ // Check if module is in cache
|
||||
/******/ if(installedModules[moduleId]) {
|
||||
/******/ return installedModules[moduleId].exports;
|
||||
/******/ }
|
||||
/******/ // Create a new module (and put it into the cache)
|
||||
/******/ var module = installedModules[moduleId] = {
|
||||
/******/ i: moduleId,
|
||||
/******/ l: false,
|
||||
/******/ exports: {}
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // Execute the module function
|
||||
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
||||
/******/
|
||||
/******/ // Flag the module as loaded
|
||||
/******/ module.l = true;
|
||||
/******/
|
||||
/******/ // Return the exports of the module
|
||||
/******/ return module.exports;
|
||||
/******/ }
|
||||
/******/
|
||||
/******/
|
||||
/******/ // expose the modules object (__webpack_modules__)
|
||||
/******/ __webpack_require__.m = modules;
|
||||
/******/
|
||||
/******/ // expose the module cache
|
||||
/******/ __webpack_require__.c = installedModules;
|
||||
/******/
|
||||
/******/ // define getter function for harmony exports
|
||||
/******/ __webpack_require__.d = function(exports, name, getter) {
|
||||
/******/ if(!__webpack_require__.o(exports, name)) {
|
||||
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
|
||||
/******/ }
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // define __esModule on exports
|
||||
/******/ __webpack_require__.r = function(exports) {
|
||||
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
||||
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||
/******/ }
|
||||
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // create a fake namespace object
|
||||
/******/ // mode & 1: value is a module id, require it
|
||||
/******/ // mode & 2: merge all properties of value into the ns
|
||||
/******/ // mode & 4: return value when already ns object
|
||||
/******/ // mode & 8|1: behave like require
|
||||
/******/ __webpack_require__.t = function(value, mode) {
|
||||
/******/ if(mode & 1) value = __webpack_require__(value);
|
||||
/******/ if(mode & 8) return value;
|
||||
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
|
||||
/******/ var ns = Object.create(null);
|
||||
/******/ __webpack_require__.r(ns);
|
||||
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
|
||||
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
|
||||
/******/ return ns;
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
||||
/******/ __webpack_require__.n = function(module) {
|
||||
/******/ var getter = module && module.__esModule ?
|
||||
/******/ function getDefault() { return module['default']; } :
|
||||
/******/ function getModuleExports() { return module; };
|
||||
/******/ __webpack_require__.d(getter, 'a', getter);
|
||||
/******/ return getter;
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // Object.prototype.hasOwnProperty.call
|
||||
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
||||
/******/
|
||||
/******/ // __webpack_public_path__
|
||||
/******/ __webpack_require__.p = "";
|
||||
/******/
|
||||
/******/
|
||||
/******/ // Load entry module and return exports
|
||||
/******/ return __webpack_require__(__webpack_require__.s = 2);
|
||||
/******/ })
|
||||
/************************************************************************/
|
||||
/******/ ({
|
||||
|
||||
/***/ 2:
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
|
||||
Component({
|
||||
options: {
|
||||
addGlobalClass: true,
|
||||
multipleSlots: true
|
||||
},
|
||||
properties: {
|
||||
title: {
|
||||
type: String,
|
||||
value: ''
|
||||
},
|
||||
subtitle: {
|
||||
type: String,
|
||||
value: ''
|
||||
}
|
||||
},
|
||||
relations: {
|
||||
'../cells/cells': {
|
||||
type: 'descendant',
|
||||
linked: function linked(target) {
|
||||
if (!this.data.firstItem) {
|
||||
this.data.firstItem = target;
|
||||
}
|
||||
if (target !== this.data.firstItem) {
|
||||
target.setOuterClass('weui-cells__group_wxss');
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
data: {
|
||||
firstItem: null
|
||||
}
|
||||
});
|
||||
|
||||
/***/ })
|
||||
|
||||
/******/ });
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"component": true,
|
||||
"usingComponents": {}
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
<view class="weui-form">
|
||||
<block wx:if="{{title || subtitle}}">
|
||||
<view class="weui-form__text-area">
|
||||
<view class="weui-form__title">{{title}}</view>
|
||||
<view class="weui-form__desc">{{subtitle}}</view>
|
||||
</view>
|
||||
</block>
|
||||
<block wx:else>
|
||||
<view class="weui-form__text-area">
|
||||
<slot name="title"></slot>
|
||||
</view>
|
||||
</block>
|
||||
<view class="weui-form__control-area">
|
||||
<view class="weui-cells__group weui-cells__group_form">
|
||||
<slot></slot>
|
||||
</view>
|
||||
</view>
|
||||
<view class="weui-form__tips-area">
|
||||
<slot name="tips"></slot>
|
||||
</view>
|
||||
<view class="weui-form__opr-area">
|
||||
<slot name="button"></slot>
|
||||
</view>
|
||||
<view class="weui-form__tips-area">
|
||||
<slot name="suffixtips"></slot>
|
||||
</view>
|
||||
<view class="weui-form__extra-area">
|
||||
<view class="weui-footer">
|
||||
<slot name="footer"></slot>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
|
@ -0,0 +1 @@
|
|||
.weui-cells__group_form:first-child .weui-cells__title{margin-top:0}.weui-cells__group_form .weui-cells__title{margin-top:24px;margin-bottom:8px;padding:0 32px}.weui-cells__group_form .weui-cells:before,.weui-cells__group_form .weui-cell:before{left:32px;right:32px}.weui-cells__group_form .weui-cells_checkbox .weui-check__label:before{left:72px}.weui-cells__group_form .weui-cells:after{left:32px;right:32px}.weui-cells__group_form .weui-cell{padding:16px 32px;color:rgba(0,0,0,0.9)}.weui-cells__group_form .weui-cell__hd{padding-right:16px}.weui-cells__group_form .weui-cell__ft{padding-left:16px}.weui-cells__group_form .weui-cell_warn input{color:#FA5151}.weui-cells__group_form .weui-label{max-width:5em;margin-right:8px}.weui-cells__group_form .weui-cells__tips{margin-top:8px;padding:0 32px;color:rgba(0,0,0,0.3)}.weui-cells__group_form .weui-cells__tips a{font-weight:700}.weui-cells__group_form .weui-cell_vcode{padding:12px 32px}.weui-cells__group_form .weui-vcode-btn{font-size:16px;padding:0 12px;margin-left:0;height:auto;width:auto;line-height:2em;color:#06AE56;background-color:#F2F2F2}.weui-cells__group_form .weui-vcode-btn:before{display:none}.weui-cells__group_form .weui-cell_select{padding:0}.weui-cells__group_form .weui-cell_select .weui-select{padding:0 32px}.weui-cells__group_form .weui-cell_select .weui-cell__bd:after{right:32px}.weui-cells__group_form .weui-cell_select-before .weui-label{margin-right:24px}.weui-cells__group_form .weui-cell_select-before .weui-select{padding-right:24px;box-sizing:initial}.weui-cells__group_form .weui-cell_select-after{padding-left:32px}.weui-cells__group_form .weui-cell_select-after .weui-select{padding-left:0}.weui-cells__group_form .weui-cell_switch{padding:12px 32px}.weui-cells__group_wxss.weui-cells__group_wxss .weui-cells__title{margin-top:24px}.weui-form{padding:56px 0 0;padding:calc(56px + constant(safe-area-inset-top)) constant(safe-area-inset-right) constant(safe-area-inset-bottom) constant(safe-area-inset-left);padding:calc(56px + env(safe-area-inset-top)) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);display:flex;flex-direction:column;min-height:100%;box-sizing:border-box;line-height:1.4;background-color:#FFFFFF}.weui-form a:not(.weui-btn){color:#576B95}.weui-form .weui-footer,.weui-form .weui-footer__link{font-size:12px}.weui-form .weui-agree{padding:0}.weui-form__text-area{padding:0 32px;color:rgba(0,0,0,0.9);text-align:center}.weui-form__control-area{flex:1;margin:48px 0}.weui-form__tips-area,.weui-form__extra-area{margin-bottom:24px;text-align:center}.weui-form__opr-area{margin-bottom:64px}.weui-form__opr-area:last-child{margin-bottom:96px}.weui-form__title{font-size:22px;font-weight:700;line-height:1.36}.weui-form__desc{font-size:17px;margin-top:16px}.weui-form__tips{color:rgba(0,0,0,0.5);font-size:12px}
|
||||
|
|
@ -0,0 +1,591 @@
|
|||
module.exports =
|
||||
/******/ (function(modules) { // webpackBootstrap
|
||||
/******/ // The module cache
|
||||
/******/ var installedModules = {};
|
||||
/******/
|
||||
/******/ // The require function
|
||||
/******/ function __webpack_require__(moduleId) {
|
||||
/******/
|
||||
/******/ // Check if module is in cache
|
||||
/******/ if(installedModules[moduleId]) {
|
||||
/******/ return installedModules[moduleId].exports;
|
||||
/******/ }
|
||||
/******/ // Create a new module (and put it into the cache)
|
||||
/******/ var module = installedModules[moduleId] = {
|
||||
/******/ i: moduleId,
|
||||
/******/ l: false,
|
||||
/******/ exports: {}
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // Execute the module function
|
||||
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
||||
/******/
|
||||
/******/ // Flag the module as loaded
|
||||
/******/ module.l = true;
|
||||
/******/
|
||||
/******/ // Return the exports of the module
|
||||
/******/ return module.exports;
|
||||
/******/ }
|
||||
/******/
|
||||
/******/
|
||||
/******/ // expose the modules object (__webpack_modules__)
|
||||
/******/ __webpack_require__.m = modules;
|
||||
/******/
|
||||
/******/ // expose the module cache
|
||||
/******/ __webpack_require__.c = installedModules;
|
||||
/******/
|
||||
/******/ // define getter function for harmony exports
|
||||
/******/ __webpack_require__.d = function(exports, name, getter) {
|
||||
/******/ if(!__webpack_require__.o(exports, name)) {
|
||||
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
|
||||
/******/ }
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // define __esModule on exports
|
||||
/******/ __webpack_require__.r = function(exports) {
|
||||
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
||||
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||
/******/ }
|
||||
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // create a fake namespace object
|
||||
/******/ // mode & 1: value is a module id, require it
|
||||
/******/ // mode & 2: merge all properties of value into the ns
|
||||
/******/ // mode & 4: return value when already ns object
|
||||
/******/ // mode & 8|1: behave like require
|
||||
/******/ __webpack_require__.t = function(value, mode) {
|
||||
/******/ if(mode & 1) value = __webpack_require__(value);
|
||||
/******/ if(mode & 8) return value;
|
||||
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
|
||||
/******/ var ns = Object.create(null);
|
||||
/******/ __webpack_require__.r(ns);
|
||||
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
|
||||
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
|
||||
/******/ return ns;
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
||||
/******/ __webpack_require__.n = function(module) {
|
||||
/******/ var getter = module && module.__esModule ?
|
||||
/******/ function getDefault() { return module['default']; } :
|
||||
/******/ function getModuleExports() { return module; };
|
||||
/******/ __webpack_require__.d(getter, 'a', getter);
|
||||
/******/ return getter;
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // Object.prototype.hasOwnProperty.call
|
||||
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
||||
/******/
|
||||
/******/ // __webpack_public_path__
|
||||
/******/ __webpack_require__.p = "";
|
||||
/******/
|
||||
/******/
|
||||
/******/ // Load entry module and return exports
|
||||
/******/ return __webpack_require__(__webpack_require__.s = 4);
|
||||
/******/ })
|
||||
/************************************************************************/
|
||||
/******/ ([
|
||||
/* 0 */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.diff = function (old, newVal) {
|
||||
if (!old && newVal || old && !newVal) return true;
|
||||
for (var k in newVal) {
|
||||
if (old[k] !== newVal[k]) return true;
|
||||
}
|
||||
for (var _k in old) {
|
||||
if (old[_k] !== newVal[_k]) return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
exports.diffObject = function (old, newVal) {
|
||||
if (!old && newVal) return newVal;
|
||||
if (!newVal && old) return old;
|
||||
var diffObj = {};
|
||||
var isDiff = false;
|
||||
for (var k in newVal) {
|
||||
if (old[k] !== newVal[k]) {
|
||||
isDiff = true;
|
||||
diffObj[k] = newVal[k];
|
||||
}
|
||||
}
|
||||
for (var _k2 in old) {
|
||||
if (old[_k2] !== newVal[_k2]) {
|
||||
isDiff = true;
|
||||
diffObj[_k2] = newVal[_k2];
|
||||
}
|
||||
}
|
||||
return isDiff ? diffObj : null;
|
||||
};
|
||||
|
||||
/***/ }),
|
||||
/* 1 */,
|
||||
/* 2 */,
|
||||
/* 3 */,
|
||||
/* 4 */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var form_validator_1 = __webpack_require__(5);
|
||||
var object_1 = __webpack_require__(0);
|
||||
function linked(target) {
|
||||
if (target.data.prop) {
|
||||
this.data.formItems[target.data.prop] = target;
|
||||
}
|
||||
if (target.setInForm) {
|
||||
target.setInForm();
|
||||
}
|
||||
if (!this.data.firstItem) {
|
||||
this.data.firstItem = target;
|
||||
}
|
||||
if (target !== this.data.firstItem) {}
|
||||
}
|
||||
function unlinked(target) {
|
||||
if (target.data.prop) {
|
||||
delete this.data.formItems[target.data.prop];
|
||||
}
|
||||
}
|
||||
Component({
|
||||
properties: {
|
||||
models: {
|
||||
type: Object,
|
||||
value: {},
|
||||
observer: '_modelChange'
|
||||
},
|
||||
rules: {
|
||||
type: Array,
|
||||
value: [],
|
||||
observer: '_rulesChange'
|
||||
},
|
||||
extClass: {
|
||||
type: String,
|
||||
value: ''
|
||||
}
|
||||
},
|
||||
data: {
|
||||
errors: {},
|
||||
formItems: {},
|
||||
firstItem: null
|
||||
},
|
||||
relations: {
|
||||
'../cell/cell': {
|
||||
type: 'descendant',
|
||||
linked: linked,
|
||||
unlinked: unlinked
|
||||
},
|
||||
'../checkbox-group/checkbox-group': {
|
||||
type: 'descendant',
|
||||
linked: linked,
|
||||
unlinked: unlinked
|
||||
}
|
||||
},
|
||||
attached: function attached() {
|
||||
this.initRules();
|
||||
this.formValidator = new form_validator_1.default(this.data.models, this.data.newRules);
|
||||
},
|
||||
|
||||
methods: {
|
||||
initRules: function initRules(rules) {
|
||||
var newRules = {};
|
||||
(rules || this.data.rules).forEach(function (rule) {
|
||||
if (rule.name && rule.rules) {
|
||||
newRules[rule.name] = rule.rules || [];
|
||||
}
|
||||
});
|
||||
this.setData({ newRules: newRules });
|
||||
return newRules;
|
||||
},
|
||||
_modelChange: function _modelChange(newVal, oldVal, path) {
|
||||
var _this = this;
|
||||
|
||||
if (!this.isInit) {
|
||||
this.isInit = true;
|
||||
return newVal;
|
||||
}
|
||||
this.formValidator.setModel(newVal);
|
||||
this.isInit = true;
|
||||
var diffObj = object_1.diffObject(oldVal, newVal);
|
||||
if (diffObj) {
|
||||
(function () {
|
||||
var isValid = true;
|
||||
var errors = [];
|
||||
var errorMap = {};
|
||||
|
||||
var _loop = function _loop(k) {
|
||||
_this.formValidator.validateField(k, diffObj[k], function (isValided, error) {
|
||||
if (error && error[k]) {
|
||||
errors.push(error[k]);
|
||||
errorMap[k] = error[k];
|
||||
}
|
||||
isValid = isValided;
|
||||
});
|
||||
};
|
||||
|
||||
for (var k in diffObj) {
|
||||
_loop(k);
|
||||
}
|
||||
_this._showErrors(diffObj, errorMap);
|
||||
_this.triggerEvent(isValid ? 'success' : 'fail', isValid ? { trigger: 'change' } : { errors: errors, trigger: 'change' });
|
||||
})();
|
||||
}
|
||||
return newVal;
|
||||
},
|
||||
_rulesChange: function _rulesChange(newVal) {
|
||||
var newRules = this.initRules(newVal);
|
||||
if (this.formValidator) {
|
||||
this.formValidator.setRules(newRules);
|
||||
}
|
||||
return newVal;
|
||||
},
|
||||
_showAllErrors: function _showAllErrors(errors) {
|
||||
for (var k in this.data.newRules) {
|
||||
this._showError(k, errors && errors[k]);
|
||||
}
|
||||
},
|
||||
_showErrors: function _showErrors(objs, errors) {
|
||||
for (var k in objs) {
|
||||
this._showError(k, errors && errors[k]);
|
||||
}
|
||||
},
|
||||
_showError: function _showError(prop, error) {
|
||||
var formItem = this.data.formItems[prop];
|
||||
if (formItem && formItem.data.showError) {
|
||||
formItem.setError(error);
|
||||
}
|
||||
},
|
||||
validate: function validate(cb) {
|
||||
var _this2 = this;
|
||||
|
||||
return this.formValidator.validate(function (isValid, errors) {
|
||||
_this2._showAllErrors(errors);
|
||||
var handleError = _this2.handleErrors(errors);
|
||||
_this2.triggerEvent(isValid ? 'success' : 'fail', isValid ? { trigger: 'validate' } : { errors: handleError, trigger: 'validate' });
|
||||
cb && cb(isValid, handleError);
|
||||
});
|
||||
},
|
||||
validateField: function validateField(name, value) {
|
||||
var _this3 = this;
|
||||
|
||||
var cb = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function (v) {
|
||||
var error = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
||||
};
|
||||
|
||||
return this.formValidator.validateField(name, value, function (isValid, errors) {
|
||||
_this3._showError(name, errors);
|
||||
var handleError = _this3.handleErrors(errors);
|
||||
_this3.triggerEvent(isValid ? 'success' : 'fail', isValid ? { trigger: 'validate' } : { errors: handleError, trigger: 'validate' });
|
||||
cb && cb(isValid, handleError);
|
||||
});
|
||||
},
|
||||
handleErrors: function handleErrors(errors) {
|
||||
if (errors) {
|
||||
var newErrors = [];
|
||||
this.data.rules.forEach(function (rule) {
|
||||
if (errors[rule.name]) {
|
||||
errors[rule.name].name = rule.name;
|
||||
newErrors.push(errors[rule.name]);
|
||||
}
|
||||
});
|
||||
return newErrors;
|
||||
}
|
||||
return errors;
|
||||
},
|
||||
addMethod: function addMethod(ruleName, method) {
|
||||
return this.formValidator.addMethod(ruleName, method);
|
||||
}
|
||||
}
|
||||
});
|
||||
exports.default = form_validator_1.default;
|
||||
|
||||
/***/ }),
|
||||
/* 5 */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var validator_1 = __webpack_require__(6);
|
||||
var object_1 = __webpack_require__(0);
|
||||
var toString = Object.prototype.toString;
|
||||
var validateSingleRule = function validateSingleRule(rule, value) {
|
||||
var param = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
||||
var models = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
|
||||
|
||||
var message = '';
|
||||
for (var ruleKey in rule) {
|
||||
if (ruleKey === 'name' || ruleKey === 'message') continue;
|
||||
var validateMethod = typeof rule.validator !== 'undefined' ? rule.validator : validator_1.default[ruleKey];
|
||||
if (typeof validateMethod === 'function') {
|
||||
message = validateMethod(rule, value, param, models);
|
||||
if (message) {
|
||||
return message;
|
||||
}
|
||||
}
|
||||
}
|
||||
return message;
|
||||
};
|
||||
|
||||
var FormValidator = function () {
|
||||
function FormValidator(models, rules) {
|
||||
_classCallCheck(this, FormValidator);
|
||||
|
||||
this.models = models;
|
||||
this.rules = rules;
|
||||
this.errors = {};
|
||||
}
|
||||
|
||||
FormValidator.prototype.validate = function validate(cb) {
|
||||
var _this = this;
|
||||
|
||||
return new Promise(function (resolve) {
|
||||
var fieldCount = 0;
|
||||
var failCount = 0;
|
||||
var errors = _this.errors;
|
||||
var models = _this.models;
|
||||
var errorChanged = false;
|
||||
|
||||
var _loop = function _loop(k) {
|
||||
(function (fieldName) {
|
||||
var oldError = errors[fieldName];
|
||||
_this._innerValidateField(k, models[fieldName], function (valid, newError) {
|
||||
fieldCount++;
|
||||
if (!valid) failCount++;
|
||||
if (object_1.diff(oldError, newError)) {
|
||||
errors[fieldName] = newError;
|
||||
errorChanged = true;
|
||||
}
|
||||
});
|
||||
})(k);
|
||||
};
|
||||
|
||||
for (var k in _this.rules) {
|
||||
_loop(k);
|
||||
}
|
||||
if (errorChanged) {}
|
||||
var keys = Object.keys(errors);
|
||||
keys.forEach(function (key) {
|
||||
if (!errors[key]) delete errors[key];
|
||||
});
|
||||
resolve({ isValid: !failCount, errors: failCount ? errors : undefined });
|
||||
cb && cb(!failCount, failCount ? errors : undefined);
|
||||
});
|
||||
};
|
||||
|
||||
FormValidator.prototype.validateField = function validateField(name, value) {
|
||||
var _this2 = this;
|
||||
|
||||
var cb = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function (v) {
|
||||
var error = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
||||
};
|
||||
|
||||
return new Promise(function (resolve) {
|
||||
_this2._innerValidateField(name, value, function (valid, error) {
|
||||
var errObj = {};
|
||||
errObj[name] = error;
|
||||
resolve({ valid: valid, error: valid ? undefined : error });
|
||||
cb(valid, valid ? undefined : errObj);
|
||||
var oldError = _this2.errors[name];
|
||||
var errorChanged = object_1.diff(oldError, error);
|
||||
if (errorChanged) {
|
||||
if (!error) delete _this2.errors[name];
|
||||
_this2.errors[name] = error;
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
FormValidator.prototype._innerValidateField = function _innerValidateField(name, value) {
|
||||
var cb = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function (v) {
|
||||
var errors = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
||||
};
|
||||
|
||||
var rules = this.rules[name];
|
||||
if (!rules) {
|
||||
console.warn("[form-validtor] rule name " + name + " not exists.");
|
||||
cb(true);
|
||||
return;
|
||||
}
|
||||
if (typeof value === 'function') {
|
||||
cb = value;
|
||||
value = undefined;
|
||||
}
|
||||
var isFail = false;
|
||||
var models = this.models;
|
||||
if (toString.call(rules) === '[object Array]') {
|
||||
rules.forEach(function (rule) {
|
||||
rule.name = name;
|
||||
var resMessage = validateSingleRule(rule, value || models[name], rule.param, models);
|
||||
if (resMessage && !isFail) {
|
||||
isFail = true;
|
||||
var error = resMessage ? { message: resMessage, rule: rule } : undefined;
|
||||
cb(false, error);
|
||||
}
|
||||
});
|
||||
if (!isFail) {
|
||||
cb(!isFail);
|
||||
}
|
||||
} else {
|
||||
var rule = rules;
|
||||
rule.name = name;
|
||||
var resMessage = validateSingleRule(rule, value || models[name], rule.param, models);
|
||||
var error = resMessage ? { message: resMessage, rule: rule } : undefined;
|
||||
if (resMessage) {
|
||||
isFail = true;
|
||||
}
|
||||
cb(!isFail, error);
|
||||
}
|
||||
};
|
||||
|
||||
FormValidator.prototype.addMethod = function addMethod(ruleName, method) {
|
||||
validator_1.default[ruleName] = method;
|
||||
};
|
||||
|
||||
FormValidator.prototype.setModel = function setModel(newModel) {
|
||||
this.models = newModel;
|
||||
};
|
||||
|
||||
FormValidator.prototype.setRules = function setRules(newRules) {
|
||||
this.rules = newRules;
|
||||
};
|
||||
|
||||
return FormValidator;
|
||||
}();
|
||||
|
||||
exports.default = FormValidator;
|
||||
|
||||
/***/ }),
|
||||
/* 6 */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var string_1 = __webpack_require__(7);
|
||||
var defaultMessage = {
|
||||
required: '%s必填',
|
||||
minlength: '长度最少为%s',
|
||||
maxlength: '长度最大为%s',
|
||||
rangelength: '长度在%s和%s之间',
|
||||
bytelength: '最多只能输入%s个字',
|
||||
min: '值最小为%s',
|
||||
max: '值最大为%s',
|
||||
range: '值的范围为%s和%s之间',
|
||||
mobile: '请输入正确的手机号',
|
||||
email: '请输入正确的电子邮件',
|
||||
url: '请输入正确的URL地址',
|
||||
equalTo: '值和字段%s不相等'
|
||||
};
|
||||
exports.default = {
|
||||
required: function required(r, val, param, models) {
|
||||
if (r.required === false) return;
|
||||
if (!val) return string_1.sprintf(r.message || defaultMessage.required, r.name);
|
||||
},
|
||||
minlength: function minlength(r, val) {
|
||||
var minlen = r.minlength;
|
||||
val = val || '';
|
||||
if (val.length < minlen) return string_1.sprintf(r.message || defaultMessage.minlength, minlen);
|
||||
},
|
||||
maxlength: function maxlength(r, val) {
|
||||
var maxlen = r.maxlength;
|
||||
val = val || '';
|
||||
if (val.length > maxlen) return string_1.sprintf(r.message || defaultMessage.maxlength, maxlen);
|
||||
},
|
||||
rangelength: function rangelength(r, val) {
|
||||
var range = r.range;
|
||||
val = val || '';
|
||||
if (val.length > range[1] || val.length < range[0]) return string_1.sprintf(r.message || defaultMessage.rangelength, range[0], range[1]);
|
||||
},
|
||||
min: function min(r, val) {
|
||||
var min = r.min;
|
||||
if (val < min) return string_1.sprintf(r.message || defaultMessage.min, min);
|
||||
},
|
||||
max: function max(r, val) {
|
||||
var max = r.max;
|
||||
if (val > max) return string_1.sprintf(r.message || defaultMessage.max, max);
|
||||
},
|
||||
range: function range(r, val) {
|
||||
var range = r.range;
|
||||
if (val < range[0] || val > range[1]) return string_1.sprintf(r.message || defaultMessage.range, range[0], range[1]);
|
||||
},
|
||||
mobile: function mobile(r, val) {
|
||||
if (r.mobile === false) return;
|
||||
val = val || '';
|
||||
if (val.length !== 11) return string_1.sprintf(r.message || defaultMessage.mobile);
|
||||
},
|
||||
email: function email(r, value) {
|
||||
if (r.email === false) return;
|
||||
if (!/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i.test(value)) {
|
||||
return string_1.sprintf(r.message || defaultMessage.email);
|
||||
}
|
||||
},
|
||||
url: function url(r, value) {
|
||||
if (r.url === false) return;
|
||||
if (!/^(https?|s?ftp|weixin):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(value)) {
|
||||
return r.message || defaultMessage.url;
|
||||
}
|
||||
},
|
||||
equalTo: function equalTo(r, value, param, models) {
|
||||
var equalTo = r.equalTo;
|
||||
if (value !== models[equalTo]) return string_1.sprintf(r.message || defaultMessage.equalTo, r.name);
|
||||
},
|
||||
bytelength: function bytelength(r, value, param, models) {
|
||||
param = r.param;
|
||||
var len = value.replace(/[^\x00-\xff]/g, '**').length;
|
||||
if (len > param) return string_1.sprintf(r.message || defaultMessage.bytelength, param);
|
||||
}
|
||||
};
|
||||
|
||||
/***/ }),
|
||||
/* 7 */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.sprintf = function () {
|
||||
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
||||
args[_key] = arguments[_key];
|
||||
}
|
||||
|
||||
var i = void 0;
|
||||
var result = args[0] || '';
|
||||
var para = void 0;
|
||||
var reg = void 0;
|
||||
var length = args.length - 1;
|
||||
if (length < 1) {
|
||||
return result;
|
||||
}
|
||||
i = 1;
|
||||
while (i < length + 1) {
|
||||
result = result.replace(/%s/, '{#' + i + '#}');
|
||||
i++;
|
||||
}
|
||||
result.replace('%s', '');
|
||||
i = 1;
|
||||
while (true) {
|
||||
para = args[i];
|
||||
if (para === undefined) {
|
||||
break;
|
||||
}
|
||||
reg = new RegExp('{#' + i + '#}', 'g');
|
||||
result = result.replace(reg, para);
|
||||
i++;
|
||||
}
|
||||
return result;
|
||||
};
|
||||
|
||||
/***/ })
|
||||
/******/ ]);
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"component": true,
|
||||
"usingComponents": {}
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
<view class="{{extClass}}">
|
||||
<slot></slot>
|
||||
</view>
|
||||
|
|
@ -0,0 +1,172 @@
|
|||
module.exports =
|
||||
/******/ (function(modules) { // webpackBootstrap
|
||||
/******/ // The module cache
|
||||
/******/ var installedModules = {};
|
||||
/******/
|
||||
/******/ // The require function
|
||||
/******/ function __webpack_require__(moduleId) {
|
||||
/******/
|
||||
/******/ // Check if module is in cache
|
||||
/******/ if(installedModules[moduleId]) {
|
||||
/******/ return installedModules[moduleId].exports;
|
||||
/******/ }
|
||||
/******/ // Create a new module (and put it into the cache)
|
||||
/******/ var module = installedModules[moduleId] = {
|
||||
/******/ i: moduleId,
|
||||
/******/ l: false,
|
||||
/******/ exports: {}
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // Execute the module function
|
||||
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
||||
/******/
|
||||
/******/ // Flag the module as loaded
|
||||
/******/ module.l = true;
|
||||
/******/
|
||||
/******/ // Return the exports of the module
|
||||
/******/ return module.exports;
|
||||
/******/ }
|
||||
/******/
|
||||
/******/
|
||||
/******/ // expose the modules object (__webpack_modules__)
|
||||
/******/ __webpack_require__.m = modules;
|
||||
/******/
|
||||
/******/ // expose the module cache
|
||||
/******/ __webpack_require__.c = installedModules;
|
||||
/******/
|
||||
/******/ // define getter function for harmony exports
|
||||
/******/ __webpack_require__.d = function(exports, name, getter) {
|
||||
/******/ if(!__webpack_require__.o(exports, name)) {
|
||||
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
|
||||
/******/ }
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // define __esModule on exports
|
||||
/******/ __webpack_require__.r = function(exports) {
|
||||
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
||||
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||
/******/ }
|
||||
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // create a fake namespace object
|
||||
/******/ // mode & 1: value is a module id, require it
|
||||
/******/ // mode & 2: merge all properties of value into the ns
|
||||
/******/ // mode & 4: return value when already ns object
|
||||
/******/ // mode & 8|1: behave like require
|
||||
/******/ __webpack_require__.t = function(value, mode) {
|
||||
/******/ if(mode & 1) value = __webpack_require__(value);
|
||||
/******/ if(mode & 8) return value;
|
||||
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
|
||||
/******/ var ns = Object.create(null);
|
||||
/******/ __webpack_require__.r(ns);
|
||||
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
|
||||
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
|
||||
/******/ return ns;
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
||||
/******/ __webpack_require__.n = function(module) {
|
||||
/******/ var getter = module && module.__esModule ?
|
||||
/******/ function getDefault() { return module['default']; } :
|
||||
/******/ function getModuleExports() { return module; };
|
||||
/******/ __webpack_require__.d(getter, 'a', getter);
|
||||
/******/ return getter;
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // Object.prototype.hasOwnProperty.call
|
||||
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
||||
/******/
|
||||
/******/ // __webpack_public_path__
|
||||
/******/ __webpack_require__.p = "";
|
||||
/******/
|
||||
/******/
|
||||
/******/ // Load entry module and return exports
|
||||
/******/ return __webpack_require__(__webpack_require__.s = 21);
|
||||
/******/ })
|
||||
/************************************************************************/
|
||||
/******/ ({
|
||||
|
||||
/***/ 21:
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
|
||||
Component({
|
||||
options: {
|
||||
addGlobalClass: true
|
||||
},
|
||||
properties: {
|
||||
imgUrls: {
|
||||
type: Array,
|
||||
value: [],
|
||||
observer: function observer(newVal, oldVal, changedPath) {
|
||||
this.setData({ currentImgs: newVal });
|
||||
}
|
||||
},
|
||||
showDelete: {
|
||||
type: Boolean,
|
||||
value: true
|
||||
},
|
||||
show: {
|
||||
type: Boolean,
|
||||
value: true
|
||||
},
|
||||
current: {
|
||||
type: Number,
|
||||
value: 0
|
||||
},
|
||||
hideOnClick: {
|
||||
type: Boolean,
|
||||
value: true
|
||||
},
|
||||
extClass: {
|
||||
type: Boolean,
|
||||
value: ''
|
||||
}
|
||||
},
|
||||
data: {
|
||||
currentImgs: []
|
||||
},
|
||||
ready: function ready() {
|
||||
var data = this.data;
|
||||
this.setData({ currentImgs: data.imgUrls });
|
||||
},
|
||||
|
||||
methods: {
|
||||
change: function change(e) {
|
||||
this.setData({
|
||||
current: e.detail.current
|
||||
});
|
||||
this.triggerEvent('change', { current: e.detail.current }, {});
|
||||
},
|
||||
deleteImg: function deleteImg() {
|
||||
var data = this.data;
|
||||
var imgs = data.currentImgs;
|
||||
var url = imgs.splice(data.current, 1);
|
||||
this.triggerEvent('delete', { url: url[0], index: data.current }, {});
|
||||
if (imgs.length === 0) {
|
||||
this.hideGallery();
|
||||
return;
|
||||
}
|
||||
this.setData({
|
||||
current: 0,
|
||||
currentImgs: imgs
|
||||
});
|
||||
},
|
||||
hideGallery: function hideGallery() {
|
||||
var data = this.data;
|
||||
if (data.hideOnClick) {
|
||||
this.setData({
|
||||
show: false
|
||||
});
|
||||
this.triggerEvent('hide', {}, {});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
/***/ })
|
||||
|
||||
/******/ });
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"component": true,
|
||||
"usingComponents": {}
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
<view class="weui-gallery {{show ? 'weui-gallery_show' : ''}} {{extClass}}">
|
||||
<view class="weui-gallery__info">{{current+1}}/{{currentImgs.length}}</view>
|
||||
<swiper class="weui-gallery__img__wrp" bindtap="hideGallery" indicator-dots="{{false}}" bindchange="change" current="{{current}}" autoplay="{{false}}" duration="{{500}}">
|
||||
<block wx:for="{{currentImgs}}" wx:key="{{item + '-' +index}}">
|
||||
<swiper-item>
|
||||
<image mode="aspectFit" class="weui-gallery__img" src="{{item}}"></image>
|
||||
</swiper-item>
|
||||
</block>
|
||||
</swiper>
|
||||
<view class="weui-gallery__opr" wx:if="{{showDelete}}">
|
||||
<navigator href="javascript:" bindtap="deleteImg" class="weui-gallery__del">删除</navigator>
|
||||
</view>
|
||||
</view>
|
||||
|
|
@ -0,0 +1 @@
|
|||
.weui-gallery{position:fixed;top:0;right:0;bottom:0;left:0;background-color:#000000;z-index:1000;-webkit-flex-direction:column;flex-direction:column;-webkit-flex-wrap:nowrap;flex-wrap:nowrap;opacity:0;visibility:hidden;transition:opacity .3s}.weui-gallery_show{display:-webkit-box;display:-webkit-flex;display:flex;visibility:visible;opacity:1}.weui-gallery__img__wrp{-webkit-box-flex:1;-webkit-flex:1;flex:1;position:relative;font-size:0}.weui-gallery__img{background:center center no-repeat;background-size:contain;position:absoulte;width:100%;height:100%}.weui-gallery__opr{background-color:#0D0D0D;color:#FFFFFF;line-height:60px;min-height:60px;padding-bottom:constant(safe-area-inset-bottom);padding-bottom:env(safe-area-inset-bottom);text-align:center}.weui-gallery__opr navigator{color:#FFFFFF}.weui-gallery__del{display:block}.weui-gallery__info{color:#FFFFFF;font-size:17px;line-height:60px;min-height:60px;text-align:center}
|
||||
|
|
@ -0,0 +1,165 @@
|
|||
module.exports =
|
||||
/******/ (function(modules) { // webpackBootstrap
|
||||
/******/ // The module cache
|
||||
/******/ var installedModules = {};
|
||||
/******/
|
||||
/******/ // The require function
|
||||
/******/ function __webpack_require__(moduleId) {
|
||||
/******/
|
||||
/******/ // Check if module is in cache
|
||||
/******/ if(installedModules[moduleId]) {
|
||||
/******/ return installedModules[moduleId].exports;
|
||||
/******/ }
|
||||
/******/ // Create a new module (and put it into the cache)
|
||||
/******/ var module = installedModules[moduleId] = {
|
||||
/******/ i: moduleId,
|
||||
/******/ l: false,
|
||||
/******/ exports: {}
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // Execute the module function
|
||||
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
||||
/******/
|
||||
/******/ // Flag the module as loaded
|
||||
/******/ module.l = true;
|
||||
/******/
|
||||
/******/ // Return the exports of the module
|
||||
/******/ return module.exports;
|
||||
/******/ }
|
||||
/******/
|
||||
/******/
|
||||
/******/ // expose the modules object (__webpack_modules__)
|
||||
/******/ __webpack_require__.m = modules;
|
||||
/******/
|
||||
/******/ // expose the module cache
|
||||
/******/ __webpack_require__.c = installedModules;
|
||||
/******/
|
||||
/******/ // define getter function for harmony exports
|
||||
/******/ __webpack_require__.d = function(exports, name, getter) {
|
||||
/******/ if(!__webpack_require__.o(exports, name)) {
|
||||
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
|
||||
/******/ }
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // define __esModule on exports
|
||||
/******/ __webpack_require__.r = function(exports) {
|
||||
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
||||
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||
/******/ }
|
||||
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // create a fake namespace object
|
||||
/******/ // mode & 1: value is a module id, require it
|
||||
/******/ // mode & 2: merge all properties of value into the ns
|
||||
/******/ // mode & 4: return value when already ns object
|
||||
/******/ // mode & 8|1: behave like require
|
||||
/******/ __webpack_require__.t = function(value, mode) {
|
||||
/******/ if(mode & 1) value = __webpack_require__(value);
|
||||
/******/ if(mode & 8) return value;
|
||||
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
|
||||
/******/ var ns = Object.create(null);
|
||||
/******/ __webpack_require__.r(ns);
|
||||
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
|
||||
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
|
||||
/******/ return ns;
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
||||
/******/ __webpack_require__.n = function(module) {
|
||||
/******/ var getter = module && module.__esModule ?
|
||||
/******/ function getDefault() { return module['default']; } :
|
||||
/******/ function getModuleExports() { return module; };
|
||||
/******/ __webpack_require__.d(getter, 'a', getter);
|
||||
/******/ return getter;
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // Object.prototype.hasOwnProperty.call
|
||||
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
||||
/******/
|
||||
/******/ // __webpack_public_path__
|
||||
/******/ __webpack_require__.p = "";
|
||||
/******/
|
||||
/******/
|
||||
/******/ // Load entry module and return exports
|
||||
/******/ return __webpack_require__(__webpack_require__.s = 17);
|
||||
/******/ })
|
||||
/************************************************************************/
|
||||
/******/ ({
|
||||
|
||||
/***/ 17:
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
|
||||
Component({
|
||||
options: {
|
||||
multipleSlots: true,
|
||||
addGlobalClass: true
|
||||
},
|
||||
properties: {
|
||||
closabled: {
|
||||
type: Boolean,
|
||||
value: true
|
||||
},
|
||||
title: {
|
||||
type: String,
|
||||
value: ''
|
||||
},
|
||||
subTitle: {
|
||||
type: String,
|
||||
value: ''
|
||||
},
|
||||
extClass: {
|
||||
type: String,
|
||||
value: ''
|
||||
},
|
||||
desc: {
|
||||
type: String,
|
||||
value: ''
|
||||
},
|
||||
tips: {
|
||||
type: String,
|
||||
value: ''
|
||||
},
|
||||
maskClosable: {
|
||||
type: Boolean,
|
||||
value: true
|
||||
},
|
||||
mask: {
|
||||
type: Boolean,
|
||||
value: true
|
||||
},
|
||||
show: {
|
||||
type: Boolean,
|
||||
value: false,
|
||||
observer: '_showChange'
|
||||
},
|
||||
buttons: {
|
||||
type: Array,
|
||||
value: []
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
close: function close(e) {
|
||||
var type = e.currentTarget.dataset.type;
|
||||
|
||||
if (this.data.maskClosable || type === 'close') {
|
||||
this.setData({
|
||||
show: false
|
||||
});
|
||||
this.triggerEvent('close');
|
||||
}
|
||||
},
|
||||
buttonTap: function buttonTap(e) {
|
||||
var index = e.currentTarget.dataset.index;
|
||||
|
||||
this.triggerEvent('buttontap', { index: index, item: this.data.buttons[index] }, {});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
/***/ })
|
||||
|
||||
/******/ });
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"component": true,
|
||||
"usingComponents": {}
|
||||
}
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
<view class="{{show ? 'weui-show' :'weui-hidden'}}">
|
||||
<view class="weui-mask init" wx:if="{{mask}}" bindtap="close" data-type="tap"></view>
|
||||
<view class="weui-half-screen-dialog {{extClass}}">
|
||||
<view class="weui-half-screen-dialog__hd">
|
||||
<view wx:if="{{closabled}}" class="weui-half-screen-dialog__hd__side" bindtap="close" data-type="close">
|
||||
<view class="weui-icon-btn weui-icon-btn_close">关闭</view>
|
||||
</view>
|
||||
<view class="weui-half-screen-dialog__hd__main">
|
||||
<block wx:if="{{title}}">
|
||||
<text class="weui-half-screen-dialog__title">{{title}}</text>
|
||||
<text class="weui-half-screen-dialog__subtitle">{{subTitle}}</text>
|
||||
</block>
|
||||
<block wx:else>
|
||||
<view class="weui-half-screen-dialog__title"><slot name="title"></slot></view>
|
||||
</block>
|
||||
</view>
|
||||
<view class="weui-half-screen-dialog__hd__side">
|
||||
<view class="weui-icon-btn weui-icon-btn_more">更多</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="weui-half-screen-dialog__bd">
|
||||
<block wx:if="{{title}}">
|
||||
<view class="weui-half-screen-dialog__desc">{{desc}}</view>
|
||||
<view class="weui-half-screen-dialog__tips">{{tips}}</view>
|
||||
</block>
|
||||
<slot name="desc" wx:else></slot>
|
||||
</view>
|
||||
<view class="weui-half-screen-dialog__ft">
|
||||
<block wx:if="{{buttons && buttons.length}}">
|
||||
<button
|
||||
wx:for="{{buttons}}"
|
||||
wx:key="{{item.text + item.index}}"
|
||||
type="{{item.type}}"
|
||||
class="weui-btn {{item.className}}"
|
||||
data-index="{{index}}"
|
||||
bindtap="buttonTap"
|
||||
>{{item.text}}</button>
|
||||
<!-- <view wx:for="{{buttons}}" class="weui-dialog__btn {{}} {{item.extClass}}" ></view> -->
|
||||
</block>
|
||||
<slot name="footer" wx:else></slot>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
|
@ -0,0 +1 @@
|
|||
.weui-half-screen-dialog{position:fixed;left:0;right:0;bottom:0;max-height:75%;z-index:5000;line-height:1.4;background-color:#FFFFFF;border-top-left-radius:12px;border-top-right-radius:12px;overflow:hidden;padding:0 24px;padding:0 calc(24px + constant(safe-area-inset-right)) constant(safe-area-inset-bottom) calc(24px + constant(safe-area-inset-left));padding:0 calc(24px + env(safe-area-inset-right)) env(safe-area-inset-bottom) calc(24px + env(safe-area-inset-left))}.weui-half-screen-dialog__hd{font-size:8px;height:8em;display:flex;align-items:center}.weui-half-screen-dialog__hd .weui-icon-btn{position:absolute;top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%)}.weui-half-screen-dialog__hd__side{position:relative;left:-8px}.weui-half-screen-dialog__hd__main{flex:1}.weui-half-screen-dialog__hd__side+.weui-half-screen-dialog__hd__main{text-align:center;padding:0 40px}.weui-half-screen-dialog__hd__main+.weui-half-screen-dialog__hd__side{right:-8px;left:auto}.weui-half-screen-dialog__hd__main+.weui-half-screen-dialog__hd__side .weui-icon-btn{right:0}.weui-half-screen-dialog__title{display:block;color:rgba(0,0,0,0.9);font-weight:700;font-size:15px}.weui-half-screen-dialog__subtitle{display:block;color:rgba(0,0,0,0.5);font-size:10px}.weui-half-screen-dialog__bd{word-wrap:break-word;-webkit-hyphens:auto;hyphens:auto;overflow-y:auto}.weui-half-screen-dialog__desc{padding-top:4px;font-size:17px;font-weight:700;color:rgba(0,0,0,0.9);line-height:1.4}.weui-half-screen-dialog__tips{padding-top:16px;font-size:14px;color:rgba(0,0,0,0.3);line-height:1.4}.weui-half-screen-dialog__ft{padding:40px 24px 32px;text-align:center}.weui-half-screen-dialog__ft .weui-btn:nth-last-child(n+2),.weui-half-screen-dialog__ft .weui-btn:nth-last-child(n+2)+.weui-btn{display:inline-block;vertical-align:top;margin:0 8px;width:120px}.weui-icon-btn{background-color:transparent;background-repeat:no-repeat;background-position:50% 50%;background-size:100%;border:0;outline:0;font-size:0}.weui-icon-btn_goback{width:12px;height:24px;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='24' viewBox='0 0 12 24'%3E %3Cg fill='none' fill-rule='evenodd' transform='translate(-16 -20)'%3E %3Cpath fill='%23FFF' d='M0 12C0 5.373 5.367 0 12 0h390c6.628 0 12 5.374 12 12v52H0V12z'/%3E %3Cpath fill='%23000' fill-opacity='.9' d='M26 39.438L24.955 40.5l-7.666-7.79a1.02 1.02 0 0 1 0-1.42l7.666-7.79L26 24.563 18.682 32 26 39.438z'/%3E %3C/g%3E%3C/svg%3E")}.weui-icon-btn_close{width:24px;height:24px;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='24' height='24' viewBox='0 0 24 24'%3E %3Cdefs%3E %3Cpath id='33cf2e7b-22e9-42d7-9c56-a9f4a4e03565-a' d='M8 6.943L1.807.75.75 1.807 6.943 8 .75 14.193l1.057 1.057L8 9.057l6.193 6.193 1.057-1.057L9.057 8l6.193-6.193L14.193.75z'/%3E %3C/defs%3E %3Cg fill='none' fill-rule='evenodd' transform='translate(-16 -20)'%3E %3Cpath fill='%23FFF' d='M0 12C0 5.373 5.367 0 12 0h390c6.628 0 12 5.374 12 12v52H0V12z'/%3E %3Cuse fill='%23000' fill-opacity='.9' transform='translate(20 24)' xlink:href='%2333cf2e7b-22e9-42d7-9c56-a9f4a4e03565-a'/%3E %3C/g%3E%3C/svg%3E")}.weui-icon-btn_more{width:24px;height:24px;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E %3Cg fill='none' fill-rule='evenodd' transform='translate(-374 -20)'%3E %3Cpath fill='%23FFF' d='M0 12C0 5.373 5.367 0 12 0h390c6.628 0 12 5.374 12 12v52H0V12z'/%3E %3Cpath fill='%23000' fill-opacity='.9' d='M380.75 32a1.75 1.75 0 1 1-3.5 0 1.75 1.75 0 0 1 3.5 0zm5.25-1.75a1.75 1.75 0 1 1 0 3.5 1.75 1.75 0 0 1 0-3.5zm7 0a1.75 1.75 0 1 1 0 3.5 1.75 1.75 0 0 1 0-3.5z'/%3E %3C/g%3E%3C/svg%3E")}.weui-mask{position:fixed;z-index:1000;top:0;right:0;left:0;bottom:0;background:rgba(0,0,0,0.6)}.weui-mask_transparent{position:fixed;z-index:1000;top:0;right:0;left:0;bottom:0}.weui-mask,.weui-half-screen-dialog{transition:all .3s}.weui-hidden .weui-mask{visibility:hidden;opacity:0}.weui-hidden .weui-half-screen-dialog{transform:translateY(100%)}.weui-show .weui-mask{opacity:1;visibility:visible}.weui-show .weui-half-screen-dialog{transform:translateY(0%)}
|
||||
File diff suppressed because one or more lines are too long
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"component": true,
|
||||
"usingComponents": {}
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
<wxs module="utils">
|
||||
var double = function(a) {
|
||||
return 2*a
|
||||
};
|
||||
var ifSpecialIcon = function(v) {
|
||||
return v === 'arrow' || v === 'back'
|
||||
}
|
||||
module.exports = {
|
||||
double: double,
|
||||
ifSpecialIcon: ifSpecialIcon
|
||||
}
|
||||
</wxs>
|
||||
|
||||
<view class="{{extClass}} weui-icon" style="background:{{color}};width:{{size}}px;height:{{ utils.ifSpecialIcon(icon) ? utils.double(size) : size}}px;mask-image:url({{src}});-webkit-mask-image:url({{src}});-moz-mask-image:url({{src}})"></view>
|
||||
|
|
@ -0,0 +1 @@
|
|||
.weui-icon{vertical-align:middle;display:inline-block;background:black;mask-repeat:no-repeat;-webkit-mask-repeat:no-repeat;-moz-mask-repeat:no-repeat;mask-size:cover;-webkit-mask-size:cover;-moz-mask-size:cover}
|
||||
|
|
@ -0,0 +1,100 @@
|
|||
module.exports =
|
||||
/******/ (function(modules) { // webpackBootstrap
|
||||
/******/ // The module cache
|
||||
/******/ var installedModules = {};
|
||||
/******/
|
||||
/******/ // The require function
|
||||
/******/ function __webpack_require__(moduleId) {
|
||||
/******/
|
||||
/******/ // Check if module is in cache
|
||||
/******/ if(installedModules[moduleId]) {
|
||||
/******/ return installedModules[moduleId].exports;
|
||||
/******/ }
|
||||
/******/ // Create a new module (and put it into the cache)
|
||||
/******/ var module = installedModules[moduleId] = {
|
||||
/******/ i: moduleId,
|
||||
/******/ l: false,
|
||||
/******/ exports: {}
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // Execute the module function
|
||||
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
||||
/******/
|
||||
/******/ // Flag the module as loaded
|
||||
/******/ module.l = true;
|
||||
/******/
|
||||
/******/ // Return the exports of the module
|
||||
/******/ return module.exports;
|
||||
/******/ }
|
||||
/******/
|
||||
/******/
|
||||
/******/ // expose the modules object (__webpack_modules__)
|
||||
/******/ __webpack_require__.m = modules;
|
||||
/******/
|
||||
/******/ // expose the module cache
|
||||
/******/ __webpack_require__.c = installedModules;
|
||||
/******/
|
||||
/******/ // define getter function for harmony exports
|
||||
/******/ __webpack_require__.d = function(exports, name, getter) {
|
||||
/******/ if(!__webpack_require__.o(exports, name)) {
|
||||
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
|
||||
/******/ }
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // define __esModule on exports
|
||||
/******/ __webpack_require__.r = function(exports) {
|
||||
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
||||
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||
/******/ }
|
||||
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // create a fake namespace object
|
||||
/******/ // mode & 1: value is a module id, require it
|
||||
/******/ // mode & 2: merge all properties of value into the ns
|
||||
/******/ // mode & 4: return value when already ns object
|
||||
/******/ // mode & 8|1: behave like require
|
||||
/******/ __webpack_require__.t = function(value, mode) {
|
||||
/******/ if(mode & 1) value = __webpack_require__(value);
|
||||
/******/ if(mode & 8) return value;
|
||||
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
|
||||
/******/ var ns = Object.create(null);
|
||||
/******/ __webpack_require__.r(ns);
|
||||
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
|
||||
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
|
||||
/******/ return ns;
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
||||
/******/ __webpack_require__.n = function(module) {
|
||||
/******/ var getter = module && module.__esModule ?
|
||||
/******/ function getDefault() { return module['default']; } :
|
||||
/******/ function getModuleExports() { return module; };
|
||||
/******/ __webpack_require__.d(getter, 'a', getter);
|
||||
/******/ return getter;
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // Object.prototype.hasOwnProperty.call
|
||||
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
||||
/******/
|
||||
/******/ // __webpack_public_path__
|
||||
/******/ __webpack_require__.p = "";
|
||||
/******/
|
||||
/******/
|
||||
/******/ // Load entry module and return exports
|
||||
/******/ return __webpack_require__(__webpack_require__.s = 26);
|
||||
/******/ })
|
||||
/************************************************************************/
|
||||
/******/ ({
|
||||
|
||||
/***/ 26:
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
|
||||
/***/ })
|
||||
|
||||
/******/ });
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
{
|
||||
"usingComponents": {
|
||||
"actionsheet": "./actionsheet/actionsheet",
|
||||
"form-page": "./form-page/form-page",
|
||||
"navigation-bar": "./navigation-bar/navigation-bar",
|
||||
"form": "./form/form",
|
||||
"cell": "./cell/cell",
|
||||
"icon": "./icon/icon",
|
||||
"toptips": "./toptips/toptips",
|
||||
"loading": "./loading/loading",
|
||||
"tabbar": "./tabbar/tabbar",
|
||||
"cells": "./cells/cells",
|
||||
"half-screen-dialog": "./half-screen-dialog/half-screen-dialog",
|
||||
"slideview": "./slideview/slideview",
|
||||
"msg": "./msg/msg",
|
||||
"dialog": "./dialog/dialog",
|
||||
"uploader": "./uploader/uploader",
|
||||
"gallery": "./gallery/gallery",
|
||||
"checkbox": "./checkbox/checkbox",
|
||||
"badge": "./badge/badge",
|
||||
"searchbar": "./searchbar/searchbar",
|
||||
"checkbox-group": "./checkbox-group/checkbox-group"
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,181 @@
|
|||
module.exports =
|
||||
/******/ (function(modules) { // webpackBootstrap
|
||||
/******/ // The module cache
|
||||
/******/ var installedModules = {};
|
||||
/******/
|
||||
/******/ // The require function
|
||||
/******/ function __webpack_require__(moduleId) {
|
||||
/******/
|
||||
/******/ // Check if module is in cache
|
||||
/******/ if(installedModules[moduleId]) {
|
||||
/******/ return installedModules[moduleId].exports;
|
||||
/******/ }
|
||||
/******/ // Create a new module (and put it into the cache)
|
||||
/******/ var module = installedModules[moduleId] = {
|
||||
/******/ i: moduleId,
|
||||
/******/ l: false,
|
||||
/******/ exports: {}
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // Execute the module function
|
||||
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
||||
/******/
|
||||
/******/ // Flag the module as loaded
|
||||
/******/ module.l = true;
|
||||
/******/
|
||||
/******/ // Return the exports of the module
|
||||
/******/ return module.exports;
|
||||
/******/ }
|
||||
/******/
|
||||
/******/
|
||||
/******/ // expose the modules object (__webpack_modules__)
|
||||
/******/ __webpack_require__.m = modules;
|
||||
/******/
|
||||
/******/ // expose the module cache
|
||||
/******/ __webpack_require__.c = installedModules;
|
||||
/******/
|
||||
/******/ // define getter function for harmony exports
|
||||
/******/ __webpack_require__.d = function(exports, name, getter) {
|
||||
/******/ if(!__webpack_require__.o(exports, name)) {
|
||||
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
|
||||
/******/ }
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // define __esModule on exports
|
||||
/******/ __webpack_require__.r = function(exports) {
|
||||
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
||||
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||
/******/ }
|
||||
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // create a fake namespace object
|
||||
/******/ // mode & 1: value is a module id, require it
|
||||
/******/ // mode & 2: merge all properties of value into the ns
|
||||
/******/ // mode & 4: return value when already ns object
|
||||
/******/ // mode & 8|1: behave like require
|
||||
/******/ __webpack_require__.t = function(value, mode) {
|
||||
/******/ if(mode & 1) value = __webpack_require__(value);
|
||||
/******/ if(mode & 8) return value;
|
||||
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
|
||||
/******/ var ns = Object.create(null);
|
||||
/******/ __webpack_require__.r(ns);
|
||||
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
|
||||
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
|
||||
/******/ return ns;
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
||||
/******/ __webpack_require__.n = function(module) {
|
||||
/******/ var getter = module && module.__esModule ?
|
||||
/******/ function getDefault() { return module['default']; } :
|
||||
/******/ function getModuleExports() { return module; };
|
||||
/******/ __webpack_require__.d(getter, 'a', getter);
|
||||
/******/ return getter;
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // Object.prototype.hasOwnProperty.call
|
||||
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
||||
/******/
|
||||
/******/ // __webpack_public_path__
|
||||
/******/ __webpack_require__.p = "";
|
||||
/******/
|
||||
/******/
|
||||
/******/ // Load entry module and return exports
|
||||
/******/ return __webpack_require__(__webpack_require__.s = 14);
|
||||
/******/ })
|
||||
/************************************************************************/
|
||||
/******/ ({
|
||||
|
||||
/***/ 14:
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
|
||||
Component({
|
||||
options: {
|
||||
addGlobalClass: true
|
||||
},
|
||||
properties: {
|
||||
extClass: {
|
||||
type: String,
|
||||
value: ''
|
||||
},
|
||||
show: {
|
||||
type: Boolean,
|
||||
value: true,
|
||||
observer: function observer(newValue) {
|
||||
this._computedStyle(newValue, this.data.animated);
|
||||
}
|
||||
},
|
||||
animated: {
|
||||
type: Boolean,
|
||||
value: false,
|
||||
observer: function observer(newValue) {
|
||||
this._computedStyle(this.data.show, newValue);
|
||||
}
|
||||
},
|
||||
duration: {
|
||||
type: Number,
|
||||
value: 350
|
||||
},
|
||||
type: {
|
||||
type: String,
|
||||
value: 'dot-gray'
|
||||
},
|
||||
tips: {
|
||||
type: String,
|
||||
value: '加载中'
|
||||
}
|
||||
},
|
||||
data: {
|
||||
animationData: {},
|
||||
animationInstance: {},
|
||||
displayStyle: 'none'
|
||||
},
|
||||
methods: {
|
||||
_computedStyle: function _computedStyle(show, animated) {
|
||||
if (!show) {
|
||||
if (!animated) {
|
||||
this.setData({
|
||||
displayStyle: 'none'
|
||||
});
|
||||
} else {
|
||||
this._startAnimation();
|
||||
}
|
||||
} else {
|
||||
this.setData({
|
||||
displayStyle: ''
|
||||
});
|
||||
}
|
||||
},
|
||||
_startAnimation: function _startAnimation() {
|
||||
var _this = this;
|
||||
|
||||
setTimeout(function () {
|
||||
var data = _this.data;
|
||||
var animation = data.animationInstance;
|
||||
animation.height(0).step();
|
||||
_this.setData({
|
||||
animationData: animation.export()
|
||||
});
|
||||
}, 0);
|
||||
}
|
||||
},
|
||||
lifetimes: {
|
||||
attached: function attached() {
|
||||
var data = this.data;
|
||||
var animationInstance = wx.createAnimation({
|
||||
duration: data.duration,
|
||||
timingFunction: 'ease'
|
||||
});
|
||||
this.setData({ animationInstance: animationInstance });
|
||||
this._computedStyle(this.data.show, this.data.animated);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
/***/ })
|
||||
|
||||
/******/ });
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"component": true,
|
||||
"usingComponents": {}
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
<view style="display:{{displayStyle}};" class="wx_loading_view {{extClass}}" animation="{{animationData}}" id="wx_loading_view">
|
||||
<view wx:if="{{type==='dot-white'}}" class="loading wx_dot_loading wx_dot_loading_white">
|
||||
</view>
|
||||
<view wx:elif="{{type==='dot-gray'}}" class="loading wx_dot_loading"></view>
|
||||
<view wx:elif="{{type==='circle'}}" class="weui-loadmore">
|
||||
<view class="weui-loading"></view>
|
||||
<view class="weui-loadmore__tips">{{tips}}</view>
|
||||
</view>
|
||||
</view>
|
||||
File diff suppressed because one or more lines are too long
|
|
@ -0,0 +1,132 @@
|
|||
module.exports =
|
||||
/******/ (function(modules) { // webpackBootstrap
|
||||
/******/ // The module cache
|
||||
/******/ var installedModules = {};
|
||||
/******/
|
||||
/******/ // The require function
|
||||
/******/ function __webpack_require__(moduleId) {
|
||||
/******/
|
||||
/******/ // Check if module is in cache
|
||||
/******/ if(installedModules[moduleId]) {
|
||||
/******/ return installedModules[moduleId].exports;
|
||||
/******/ }
|
||||
/******/ // Create a new module (and put it into the cache)
|
||||
/******/ var module = installedModules[moduleId] = {
|
||||
/******/ i: moduleId,
|
||||
/******/ l: false,
|
||||
/******/ exports: {}
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // Execute the module function
|
||||
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
||||
/******/
|
||||
/******/ // Flag the module as loaded
|
||||
/******/ module.l = true;
|
||||
/******/
|
||||
/******/ // Return the exports of the module
|
||||
/******/ return module.exports;
|
||||
/******/ }
|
||||
/******/
|
||||
/******/
|
||||
/******/ // expose the modules object (__webpack_modules__)
|
||||
/******/ __webpack_require__.m = modules;
|
||||
/******/
|
||||
/******/ // expose the module cache
|
||||
/******/ __webpack_require__.c = installedModules;
|
||||
/******/
|
||||
/******/ // define getter function for harmony exports
|
||||
/******/ __webpack_require__.d = function(exports, name, getter) {
|
||||
/******/ if(!__webpack_require__.o(exports, name)) {
|
||||
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
|
||||
/******/ }
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // define __esModule on exports
|
||||
/******/ __webpack_require__.r = function(exports) {
|
||||
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
||||
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||
/******/ }
|
||||
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // create a fake namespace object
|
||||
/******/ // mode & 1: value is a module id, require it
|
||||
/******/ // mode & 2: merge all properties of value into the ns
|
||||
/******/ // mode & 4: return value when already ns object
|
||||
/******/ // mode & 8|1: behave like require
|
||||
/******/ __webpack_require__.t = function(value, mode) {
|
||||
/******/ if(mode & 1) value = __webpack_require__(value);
|
||||
/******/ if(mode & 8) return value;
|
||||
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
|
||||
/******/ var ns = Object.create(null);
|
||||
/******/ __webpack_require__.r(ns);
|
||||
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
|
||||
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
|
||||
/******/ return ns;
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
||||
/******/ __webpack_require__.n = function(module) {
|
||||
/******/ var getter = module && module.__esModule ?
|
||||
/******/ function getDefault() { return module['default']; } :
|
||||
/******/ function getModuleExports() { return module; };
|
||||
/******/ __webpack_require__.d(getter, 'a', getter);
|
||||
/******/ return getter;
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // Object.prototype.hasOwnProperty.call
|
||||
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
||||
/******/
|
||||
/******/ // __webpack_public_path__
|
||||
/******/ __webpack_require__.p = "";
|
||||
/******/
|
||||
/******/
|
||||
/******/ // Load entry module and return exports
|
||||
/******/ return __webpack_require__(__webpack_require__.s = 19);
|
||||
/******/ })
|
||||
/************************************************************************/
|
||||
/******/ ({
|
||||
|
||||
/***/ 19:
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
|
||||
Component({
|
||||
options: {
|
||||
addGlobalClass: true,
|
||||
multipleSlots: true
|
||||
},
|
||||
properties: {
|
||||
title: {
|
||||
type: String,
|
||||
value: ''
|
||||
},
|
||||
type: {
|
||||
type: String,
|
||||
value: ''
|
||||
},
|
||||
icon: {
|
||||
type: String,
|
||||
value: ''
|
||||
},
|
||||
desc: {
|
||||
type: String,
|
||||
value: ''
|
||||
},
|
||||
extClass: {
|
||||
type: String,
|
||||
value: ''
|
||||
},
|
||||
size: {
|
||||
type: Number,
|
||||
value: 64
|
||||
}
|
||||
},
|
||||
data: {}
|
||||
});
|
||||
|
||||
/***/ })
|
||||
|
||||
/******/ });
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"component": true,
|
||||
"usingComponents": {}
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
<view class="weui-msg {{extClass}}">
|
||||
<view class="weui-msg__icon-area">
|
||||
<icon type="{{type}}" size="{{size}}" wx:if="{{type}}"></icon>
|
||||
<image src="{{icon}}" mode="aspectFit" wx:elif="{{icon}}" />
|
||||
</view>
|
||||
<view class="weui-msg__text-area">
|
||||
<view class="weui-msg__title">{{title}}</view>
|
||||
<view class="weui-msg__desc">
|
||||
{{desc}}
|
||||
<slot name="desc" wx:if="{{!desc}}"></slot>
|
||||
</view>
|
||||
<slot name="extend"></slot>
|
||||
</view>
|
||||
<view class="weui-msg__opr-area">
|
||||
<view class="weui-btn-area">
|
||||
<slot name="handle"></slot>
|
||||
</view>
|
||||
</view>
|
||||
<view class="weui-msg__extra-area">
|
||||
<view class="weui-footer">
|
||||
<slot name="footer"></slot>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
|
@ -0,0 +1 @@
|
|||
.weui-msg{padding-top:36px;padding:calc(36px + constant(safe-area-inset-top)) constant(safe-area-inset-right) constant(safe-area-inset-bottom) constant(safe-area-inset-left);padding:calc(36px + env(safe-area-inset-top)) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);text-align:center;line-height:1.4;min-height:100%;box-sizing:border-box;display:flex;flex-direction:column;background-color:#FFFFFF}.weui-msg__link{color:#576B95;display:inline-block;vertical-align:baseline}.weui-msg__icon-area{margin-bottom:32px}.weui-msg__text-area{margin-bottom:32px;padding:0 32px;flex:1;line-height:1.6}.weui-msg__text-area:first-child{padding-top:96px}.weui-msg__title{margin-bottom:5px;font-weight:700;font-size:22px;word-wrap:break-word;word-break:break-all}.weui-msg__desc{font-size:17px;color:rgba(0,0,0,0.9);word-wrap:break-word;word-break:break-all;margin-bottom:16px}.weui-msg__desc-primary{font-size:14px;color:rgba(0,0,0,0.5);word-wrap:break-word;word-break:break-all;margin-bottom:16px}.weui-msg__opr-area{margin-bottom:16px}.weui-msg__opr-area .weui-btn-area{margin:0 16px}.weui-msg__opr-area .weui-btn+.weui-btn{margin-bottom:16px}.weui-msg__opr-area:last-child{margin-bottom:96px}.weui-msg__opr-area+.weui-msg__extra-area{margin-top:48px}.weui-msg__tips-area{margin-bottom:16px;padding:0 40px}.weui-msg__opr-area+.weui-msg__tips-area{margin-bottom:48px}.weui-msg__tips-area:last-child{margin-bottom:64px}.weui-msg__tips{font-size:12px;color:rgba(0,0,0,0.5)}.weui-msg__extra-area{position:static;margin-bottom:24px;font-size:12px;color:rgba(0,0,0,0.5)}.weui-msg__icon-area image{width:190rpx;height:190rpx}
|
||||
|
|
@ -0,0 +1,189 @@
|
|||
module.exports =
|
||||
/******/ (function(modules) { // webpackBootstrap
|
||||
/******/ // The module cache
|
||||
/******/ var installedModules = {};
|
||||
/******/
|
||||
/******/ // The require function
|
||||
/******/ function __webpack_require__(moduleId) {
|
||||
/******/
|
||||
/******/ // Check if module is in cache
|
||||
/******/ if(installedModules[moduleId]) {
|
||||
/******/ return installedModules[moduleId].exports;
|
||||
/******/ }
|
||||
/******/ // Create a new module (and put it into the cache)
|
||||
/******/ var module = installedModules[moduleId] = {
|
||||
/******/ i: moduleId,
|
||||
/******/ l: false,
|
||||
/******/ exports: {}
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // Execute the module function
|
||||
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
||||
/******/
|
||||
/******/ // Flag the module as loaded
|
||||
/******/ module.l = true;
|
||||
/******/
|
||||
/******/ // Return the exports of the module
|
||||
/******/ return module.exports;
|
||||
/******/ }
|
||||
/******/
|
||||
/******/
|
||||
/******/ // expose the modules object (__webpack_modules__)
|
||||
/******/ __webpack_require__.m = modules;
|
||||
/******/
|
||||
/******/ // expose the module cache
|
||||
/******/ __webpack_require__.c = installedModules;
|
||||
/******/
|
||||
/******/ // define getter function for harmony exports
|
||||
/******/ __webpack_require__.d = function(exports, name, getter) {
|
||||
/******/ if(!__webpack_require__.o(exports, name)) {
|
||||
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
|
||||
/******/ }
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // define __esModule on exports
|
||||
/******/ __webpack_require__.r = function(exports) {
|
||||
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
||||
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||
/******/ }
|
||||
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // create a fake namespace object
|
||||
/******/ // mode & 1: value is a module id, require it
|
||||
/******/ // mode & 2: merge all properties of value into the ns
|
||||
/******/ // mode & 4: return value when already ns object
|
||||
/******/ // mode & 8|1: behave like require
|
||||
/******/ __webpack_require__.t = function(value, mode) {
|
||||
/******/ if(mode & 1) value = __webpack_require__(value);
|
||||
/******/ if(mode & 8) return value;
|
||||
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
|
||||
/******/ var ns = Object.create(null);
|
||||
/******/ __webpack_require__.r(ns);
|
||||
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
|
||||
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
|
||||
/******/ return ns;
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
||||
/******/ __webpack_require__.n = function(module) {
|
||||
/******/ var getter = module && module.__esModule ?
|
||||
/******/ function getDefault() { return module['default']; } :
|
||||
/******/ function getModuleExports() { return module; };
|
||||
/******/ __webpack_require__.d(getter, 'a', getter);
|
||||
/******/ return getter;
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // Object.prototype.hasOwnProperty.call
|
||||
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
||||
/******/
|
||||
/******/ // __webpack_public_path__
|
||||
/******/ __webpack_require__.p = "";
|
||||
/******/
|
||||
/******/
|
||||
/******/ // Load entry module and return exports
|
||||
/******/ return __webpack_require__(__webpack_require__.s = 3);
|
||||
/******/ })
|
||||
/************************************************************************/
|
||||
/******/ ({
|
||||
|
||||
/***/ 3:
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
|
||||
Component({
|
||||
options: {
|
||||
multipleSlots: true,
|
||||
addGlobalClass: true
|
||||
},
|
||||
properties: {
|
||||
extClass: {
|
||||
type: String,
|
||||
value: ''
|
||||
},
|
||||
title: {
|
||||
type: String,
|
||||
value: ''
|
||||
},
|
||||
background: {
|
||||
type: String,
|
||||
value: ''
|
||||
},
|
||||
color: {
|
||||
type: String,
|
||||
value: ''
|
||||
},
|
||||
back: {
|
||||
type: Boolean,
|
||||
value: true
|
||||
},
|
||||
loading: {
|
||||
type: Boolean,
|
||||
value: false
|
||||
},
|
||||
animated: {
|
||||
type: Boolean,
|
||||
value: true
|
||||
},
|
||||
show: {
|
||||
type: Boolean,
|
||||
value: true,
|
||||
observer: '_showChange'
|
||||
},
|
||||
delta: {
|
||||
type: Number,
|
||||
value: 1
|
||||
}
|
||||
},
|
||||
data: {
|
||||
displayStyle: ''
|
||||
},
|
||||
attached: function attached() {
|
||||
var _this = this;
|
||||
|
||||
var isSupport = !!wx.getMenuButtonBoundingClientRect;
|
||||
var rect = wx.getMenuButtonBoundingClientRect ? wx.getMenuButtonBoundingClientRect() : null;
|
||||
wx.getSystemInfo({
|
||||
success: function success(res) {
|
||||
var ios = !!(res.system.toLowerCase().search('ios') + 1);
|
||||
_this.setData({
|
||||
ios: ios,
|
||||
statusBarHeight: res.statusBarHeight,
|
||||
innerWidth: isSupport ? 'width:' + rect.left + 'px' : '',
|
||||
innerPaddingRight: isSupport ? 'padding-right:' + (res.windowWidth - rect.left) + 'px' : '',
|
||||
leftWidth: isSupport ? 'width:' + (res.windowWidth - rect.left) + 'px' : ''
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
methods: {
|
||||
_showChange: function _showChange(show) {
|
||||
var animated = this.data.animated;
|
||||
var displayStyle = '';
|
||||
if (animated) {
|
||||
displayStyle = 'opacity: ' + (show ? '1' : '0') + ';-webkit-transition:opacity 0.5s;transition:opacity 0.5s;';
|
||||
} else {
|
||||
displayStyle = 'display: ' + (show ? '' : 'none');
|
||||
}
|
||||
this.setData({
|
||||
displayStyle: displayStyle
|
||||
});
|
||||
},
|
||||
back: function back() {
|
||||
var data = this.data;
|
||||
if (data.delta) {
|
||||
wx.navigateBack({
|
||||
delta: data.delta
|
||||
});
|
||||
}
|
||||
this.triggerEvent('back', { delta: data.delta }, {});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
/***/ })
|
||||
|
||||
/******/ });
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"component": true,
|
||||
"usingComponents": {}
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
<view class="weui-navigation-bar {{extClass}}">
|
||||
<view class="weui-navigation-bar__placeholder {{ios ? 'ios' : 'android'}}" style="padding-top: {{statusBarHeight}}px;visibility: hidden;"></view>
|
||||
<view class="weui-navigation-bar__inner {{ios ? 'ios' : 'android'}}" style="padding-top: {{statusBarHeight}}px; color: {{color}};background: {{background}};{{displayStyle}};{{innerPaddingRight}};{{innerWidth}};">
|
||||
|
||||
<view class='weui-navigation-bar__left' style="{{leftWidth}}">
|
||||
<block wx:if="{{back}}">
|
||||
<view class="weui-navigation-bar__buttons">
|
||||
<view bindtap="back" class="weui-navigation-bar__button weui-navigation-bar__btn_goback"></view>
|
||||
</view>
|
||||
</block>
|
||||
<block wx:else>
|
||||
<slot name="left"></slot>
|
||||
</block>
|
||||
</view>
|
||||
|
||||
<view class='weui-navigation-bar__center'>
|
||||
<view wx:if="{{loading}}" class="weui-navigation-bar__loading">
|
||||
<view class="weui-loading" style="width:{{size.width}}rpx;height:{{size.height}}rpx;"></view>
|
||||
</view>
|
||||
<block wx:if="{{title}}">
|
||||
<text>{{title}}</text>
|
||||
</block>
|
||||
<block wx:else>
|
||||
<slot name="center"></slot>
|
||||
</block>
|
||||
</view>
|
||||
|
||||
<view class='weui-navigation-bar__right'>
|
||||
<slot name="right"></slot>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
|
@ -0,0 +1 @@
|
|||
page{--height:44px;--right:190rpx}.weui-navigation-bar{overflow:hidden}.weui-navigation-bar .android{--height:48px;--right:222rpx}.weui-navigation-bar__inner{position:fixed;top:0;left:0;z-index:5001;height:var(--height);display:flex;align-items:center;padding-right:var(--right);width:calc(100% - var(--right))}.weui-navigation-bar__inner .weui-navigation-bar__left{position:relative;width:var(--right);padding-left:16px;display:-webkit-box;display:-webkit-flex;display:flex;align-items:center;-webkit-box-pack:center}.weui-navigation-bar__inner .weui-navigation-bar__left .weui-navigation-bar__btn{display:inline-block;vertical-align:middle;background-repeat:no-repeat}.weui-navigation-bar__inner .weui-navigation-bar__left .weui-navigation-bar__btn_goback{font-size:12px;width:1em;height:2em;background-image:url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='24' viewBox='0 0 12 24'%3E %3Cpath fill-opacity='.9' fill-rule='evenodd' d='M10 19.438L8.955 20.5l-7.666-7.79a1.02 1.02 0 0 1 0-1.42L8.955 3.5 10 4.563 2.682 12 10 19.438z'/%3E%3C/svg%3E");background-position:50% 50%;background-size:cover}.weui-navigation-bar__inner .weui-navigation-bar__left .weui-navigation-bar__btn_goback:active{opacity:.5}.weui-navigation-bar__inner .weui-navigation-bar__center{font-size:17px;text-align:center;position:relative;flex:1;display:-webkit-box;display:-webkit-flex;display:flex;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;justify-content:center}.weui-navigation-bar__inner .weui-navigation-bar__loading{font-size:0}.weui-navigation-bar__inner .weui-navigation-bar__loading .weui-loading{margin-left:0}.weui-navigation-bar__inner .weui-navigation-bar__right{margin-right:16px}.weui-navigation-bar__placeholder{height:var(--height);background:#F8F8F8;position:relative;z-index:50}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"name": "weui-miniprogram",
|
||||
"version": "0.2.1",
|
||||
"description": "",
|
||||
"author": "xushengni,tomylin,cunjinli,rockhou",
|
||||
"license": "MIT"
|
||||
}
|
||||
|
|
@ -0,0 +1,209 @@
|
|||
module.exports =
|
||||
/******/ (function(modules) { // webpackBootstrap
|
||||
/******/ // The module cache
|
||||
/******/ var installedModules = {};
|
||||
/******/
|
||||
/******/ // The require function
|
||||
/******/ function __webpack_require__(moduleId) {
|
||||
/******/
|
||||
/******/ // Check if module is in cache
|
||||
/******/ if(installedModules[moduleId]) {
|
||||
/******/ return installedModules[moduleId].exports;
|
||||
/******/ }
|
||||
/******/ // Create a new module (and put it into the cache)
|
||||
/******/ var module = installedModules[moduleId] = {
|
||||
/******/ i: moduleId,
|
||||
/******/ l: false,
|
||||
/******/ exports: {}
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // Execute the module function
|
||||
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
||||
/******/
|
||||
/******/ // Flag the module as loaded
|
||||
/******/ module.l = true;
|
||||
/******/
|
||||
/******/ // Return the exports of the module
|
||||
/******/ return module.exports;
|
||||
/******/ }
|
||||
/******/
|
||||
/******/
|
||||
/******/ // expose the modules object (__webpack_modules__)
|
||||
/******/ __webpack_require__.m = modules;
|
||||
/******/
|
||||
/******/ // expose the module cache
|
||||
/******/ __webpack_require__.c = installedModules;
|
||||
/******/
|
||||
/******/ // define getter function for harmony exports
|
||||
/******/ __webpack_require__.d = function(exports, name, getter) {
|
||||
/******/ if(!__webpack_require__.o(exports, name)) {
|
||||
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
|
||||
/******/ }
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // define __esModule on exports
|
||||
/******/ __webpack_require__.r = function(exports) {
|
||||
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
||||
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||
/******/ }
|
||||
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // create a fake namespace object
|
||||
/******/ // mode & 1: value is a module id, require it
|
||||
/******/ // mode & 2: merge all properties of value into the ns
|
||||
/******/ // mode & 4: return value when already ns object
|
||||
/******/ // mode & 8|1: behave like require
|
||||
/******/ __webpack_require__.t = function(value, mode) {
|
||||
/******/ if(mode & 1) value = __webpack_require__(value);
|
||||
/******/ if(mode & 8) return value;
|
||||
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
|
||||
/******/ var ns = Object.create(null);
|
||||
/******/ __webpack_require__.r(ns);
|
||||
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
|
||||
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
|
||||
/******/ return ns;
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
||||
/******/ __webpack_require__.n = function(module) {
|
||||
/******/ var getter = module && module.__esModule ?
|
||||
/******/ function getDefault() { return module['default']; } :
|
||||
/******/ function getModuleExports() { return module; };
|
||||
/******/ __webpack_require__.d(getter, 'a', getter);
|
||||
/******/ return getter;
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // Object.prototype.hasOwnProperty.call
|
||||
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
||||
/******/
|
||||
/******/ // __webpack_public_path__
|
||||
/******/ __webpack_require__.p = "";
|
||||
/******/
|
||||
/******/
|
||||
/******/ // Load entry module and return exports
|
||||
/******/ return __webpack_require__(__webpack_require__.s = 25);
|
||||
/******/ })
|
||||
/************************************************************************/
|
||||
/******/ ({
|
||||
|
||||
/***/ 25:
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
|
||||
Component({
|
||||
options: {
|
||||
addGlobalClass: true
|
||||
},
|
||||
properties: {
|
||||
extClass: {
|
||||
type: String,
|
||||
value: ''
|
||||
},
|
||||
focus: {
|
||||
type: Boolean,
|
||||
value: false
|
||||
},
|
||||
placeholder: {
|
||||
type: String,
|
||||
value: '搜索'
|
||||
},
|
||||
value: {
|
||||
type: String,
|
||||
value: ''
|
||||
},
|
||||
search: {
|
||||
type: Function,
|
||||
value: null
|
||||
},
|
||||
throttle: {
|
||||
type: Number,
|
||||
value: 500
|
||||
},
|
||||
cancelText: {
|
||||
type: String,
|
||||
value: '取消'
|
||||
},
|
||||
cancel: {
|
||||
type: Boolean,
|
||||
value: true
|
||||
}
|
||||
},
|
||||
data: {
|
||||
result: []
|
||||
},
|
||||
lastSearch: Date.now(),
|
||||
lifetimes: {
|
||||
attached: function attached() {
|
||||
if (this.data.focus) {
|
||||
this.setData({
|
||||
searchState: true
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
clearInput: function clearInput() {
|
||||
this.setData({
|
||||
value: ''
|
||||
});
|
||||
this.triggerEvent('clear');
|
||||
},
|
||||
inputFocus: function inputFocus(e) {
|
||||
this.triggerEvent('focus', e.detail);
|
||||
},
|
||||
inputBlur: function inputBlur(e) {
|
||||
this.setData({
|
||||
focus: false
|
||||
});
|
||||
this.triggerEvent('blur', e.detail);
|
||||
},
|
||||
showInput: function showInput() {
|
||||
this.setData({
|
||||
focus: true,
|
||||
searchState: true
|
||||
});
|
||||
},
|
||||
hideInput: function hideInput() {
|
||||
this.setData({
|
||||
searchState: false
|
||||
});
|
||||
},
|
||||
inputChange: function inputChange(e) {
|
||||
var _this = this;
|
||||
|
||||
this.setData({
|
||||
value: e.detail.value
|
||||
});
|
||||
this.triggerEvent('input', e.detail);
|
||||
if (Date.now() - this.lastSearch < this.data.throttle) {
|
||||
return;
|
||||
}
|
||||
if (typeof this.data.search !== 'function') {
|
||||
return;
|
||||
}
|
||||
this.lastSearch = Date.now();
|
||||
this.timerId = setTimeout(function () {
|
||||
_this.data.search(e.detail.value).then(function (json) {
|
||||
_this.setData({
|
||||
result: json
|
||||
});
|
||||
}).catch(function (err) {
|
||||
console.log('search error', err);
|
||||
});
|
||||
}, this.data.throttle);
|
||||
},
|
||||
selectResult: function selectResult(e) {
|
||||
var index = e.currentTarget.dataset.index;
|
||||
|
||||
var item = this.data.result[index];
|
||||
this.triggerEvent('selectresult', { index: index, item: item });
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
/***/ })
|
||||
|
||||
/******/ });
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"mp-cells": "../cells/cells",
|
||||
"mp-cell": "../cell/cell"
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
<view class="weui-search-bar {{extClass}}">
|
||||
<view class="weui-search-bar__form">
|
||||
<view class="weui-search-bar__box">
|
||||
<icon class="weui-icon-search_in-box" type="search" size="12"></icon>
|
||||
<input type="text" class="weui-search-bar__input" placeholder="{{placeholder}}" value="{{value}}" focus="{{focus}}" bindblur="inputBlur" bindfocus="inputFocus" bindinput="inputChange" />
|
||||
<view class="weui-icon-clear" wx:if="{{value.length > 0}}" bindtap="clearInput">
|
||||
<icon type="clear" size="12"></icon>
|
||||
</view>
|
||||
</view>
|
||||
<label class="weui-search-bar__label" hidden="{{searchState}}" bindtap="showInput">
|
||||
<icon class="weui-icon-search" type="search" size="12"></icon>
|
||||
<view class="weui-search-bar__text">搜索</view>
|
||||
</label>
|
||||
</view>
|
||||
<view wx:if="{{cancel && searchState}}" class="weui-search-bar__cancel-btn" bindtap="hideInput">{{cancelText}}</view>
|
||||
</view>
|
||||
<mp-cells class="searchbar-result {{extClass}}" wx:if="{{searchState && result.length > 0}}">
|
||||
<mp-cell bindtap="selectResult" data-index="{{index}}" wx:for="{{result}}" hover>
|
||||
<view>{{item.text}}</view>
|
||||
</mp-cell>
|
||||
</mp-cells>
|
||||
|
|
@ -0,0 +1 @@
|
|||
.weui-search-bar{position:relative;padding:8px;display:flex;box-sizing:border-box;background-color:#EDEDED;-webkit-text-size-adjust:100%;align-items:center}.weui-icon-search{margin-right:8px;font-size:14px;vertical-align:top;margin-top:.64em;height:1em;line-height:1em}.weui-icon-search_in-box{position:absolute;left:12px;top:50%;margin-top:-8px}.weui-search-bar__text{display:inline-block;font-size:14px;vertical-align:top}.weui-search-bar__form{position:relative;flex:auto;border-radius:4px;background:#FFFFFF}.weui-search-bar__box{position:relative;padding-left:32px;padding-right:32px;width:100%;box-sizing:border-box;z-index:1}.weui-search-bar__input{height:32px;line-height:32px;font-size:14px;caret-color:#07C160}.weui-icon-clear{position:absolute;top:0;right:0;bottom:0;padding:0 12px;font-size:0}.weui-icon-clear:after{content:"";height:100%;vertical-align:middle;display:inline-block;width:0;overflow:hidden}.weui-search-bar__label{position:absolute;top:0;right:0;bottom:0;left:0;z-index:2;border-radius:4px;text-align:center;color:rgba(0,0,0,0.5);background:#FFFFFF;line-height:32px}.weui-search-bar__cancel-btn{margin-left:8px;line-height:32px;color:#576B95;white-space:nowrap}
|
||||
|
|
@ -0,0 +1,205 @@
|
|||
module.exports =
|
||||
/******/ (function(modules) { // webpackBootstrap
|
||||
/******/ // The module cache
|
||||
/******/ var installedModules = {};
|
||||
/******/
|
||||
/******/ // The require function
|
||||
/******/ function __webpack_require__(moduleId) {
|
||||
/******/
|
||||
/******/ // Check if module is in cache
|
||||
/******/ if(installedModules[moduleId]) {
|
||||
/******/ return installedModules[moduleId].exports;
|
||||
/******/ }
|
||||
/******/ // Create a new module (and put it into the cache)
|
||||
/******/ var module = installedModules[moduleId] = {
|
||||
/******/ i: moduleId,
|
||||
/******/ l: false,
|
||||
/******/ exports: {}
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // Execute the module function
|
||||
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
||||
/******/
|
||||
/******/ // Flag the module as loaded
|
||||
/******/ module.l = true;
|
||||
/******/
|
||||
/******/ // Return the exports of the module
|
||||
/******/ return module.exports;
|
||||
/******/ }
|
||||
/******/
|
||||
/******/
|
||||
/******/ // expose the modules object (__webpack_modules__)
|
||||
/******/ __webpack_require__.m = modules;
|
||||
/******/
|
||||
/******/ // expose the module cache
|
||||
/******/ __webpack_require__.c = installedModules;
|
||||
/******/
|
||||
/******/ // define getter function for harmony exports
|
||||
/******/ __webpack_require__.d = function(exports, name, getter) {
|
||||
/******/ if(!__webpack_require__.o(exports, name)) {
|
||||
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
|
||||
/******/ }
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // define __esModule on exports
|
||||
/******/ __webpack_require__.r = function(exports) {
|
||||
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
||||
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||
/******/ }
|
||||
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // create a fake namespace object
|
||||
/******/ // mode & 1: value is a module id, require it
|
||||
/******/ // mode & 2: merge all properties of value into the ns
|
||||
/******/ // mode & 4: return value when already ns object
|
||||
/******/ // mode & 8|1: behave like require
|
||||
/******/ __webpack_require__.t = function(value, mode) {
|
||||
/******/ if(mode & 1) value = __webpack_require__(value);
|
||||
/******/ if(mode & 8) return value;
|
||||
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
|
||||
/******/ var ns = Object.create(null);
|
||||
/******/ __webpack_require__.r(ns);
|
||||
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
|
||||
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
|
||||
/******/ return ns;
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
||||
/******/ __webpack_require__.n = function(module) {
|
||||
/******/ var getter = module && module.__esModule ?
|
||||
/******/ function getDefault() { return module['default']; } :
|
||||
/******/ function getModuleExports() { return module; };
|
||||
/******/ __webpack_require__.d(getter, 'a', getter);
|
||||
/******/ return getter;
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // Object.prototype.hasOwnProperty.call
|
||||
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
||||
/******/
|
||||
/******/ // __webpack_public_path__
|
||||
/******/ __webpack_require__.p = "";
|
||||
/******/
|
||||
/******/
|
||||
/******/ // Load entry module and return exports
|
||||
/******/ return __webpack_require__(__webpack_require__.s = 18);
|
||||
/******/ })
|
||||
/************************************************************************/
|
||||
/******/ ({
|
||||
|
||||
/***/ 18:
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
|
||||
Component({
|
||||
options: {
|
||||
addGlobalClass: true,
|
||||
multipleSlots: true
|
||||
},
|
||||
properties: {
|
||||
extClass: {
|
||||
type: String,
|
||||
value: ''
|
||||
},
|
||||
buttons: {
|
||||
type: Array,
|
||||
value: [],
|
||||
observer: function observer(newVal) {
|
||||
this.addClassNameForButton();
|
||||
}
|
||||
},
|
||||
disable: {
|
||||
type: Boolean,
|
||||
value: false
|
||||
},
|
||||
icon: {
|
||||
type: Boolean,
|
||||
value: false
|
||||
},
|
||||
show: {
|
||||
type: Boolean,
|
||||
value: false
|
||||
},
|
||||
duration: {
|
||||
type: Number,
|
||||
value: 350
|
||||
},
|
||||
throttle: {
|
||||
type: Number,
|
||||
value: 40
|
||||
},
|
||||
rebounce: {
|
||||
type: Number,
|
||||
value: 0
|
||||
}
|
||||
},
|
||||
data: {
|
||||
size: null
|
||||
},
|
||||
ready: function ready() {
|
||||
this.updateRight();
|
||||
this.addClassNameForButton();
|
||||
},
|
||||
|
||||
methods: {
|
||||
updateRight: function updateRight() {
|
||||
var _this = this;
|
||||
|
||||
var data = this.data;
|
||||
var query = wx.createSelectorQuery().in(this);
|
||||
query.select('.left').boundingClientRect(function (res) {
|
||||
console.log('right res', res);
|
||||
var btnQuery = wx.createSelectorQuery().in(_this);
|
||||
btnQuery.selectAll('.btn').boundingClientRect(function (rects) {
|
||||
console.log('btn rects', rects);
|
||||
_this.setData({
|
||||
size: {
|
||||
buttons: rects,
|
||||
button: res,
|
||||
show: data.show,
|
||||
disable: data.disable,
|
||||
throttle: data.throttle,
|
||||
rebounce: data.rebounce
|
||||
}
|
||||
});
|
||||
}).exec();
|
||||
}).exec();
|
||||
},
|
||||
addClassNameForButton: function addClassNameForButton() {
|
||||
var _data = this.data,
|
||||
buttons = _data.buttons,
|
||||
icon = _data.icon;
|
||||
|
||||
buttons.forEach(function (btn) {
|
||||
if (icon) {
|
||||
btn.className = '';
|
||||
} else if (btn.type === 'warn') {
|
||||
btn.className = 'weui-slideview__btn-group_warn';
|
||||
} else {
|
||||
btn.className = 'weui-slideview__btn-group_default';
|
||||
}
|
||||
});
|
||||
this.setData({
|
||||
buttons: buttons
|
||||
});
|
||||
},
|
||||
buttonTapByWxs: function buttonTapByWxs(data) {
|
||||
this.triggerEvent('buttontap', data, {});
|
||||
},
|
||||
hide: function hide() {
|
||||
this.triggerEvent('hide', {}, {});
|
||||
},
|
||||
show: function show() {
|
||||
this.triggerEvent('show', {}, {});
|
||||
},
|
||||
transitionEnd: function transitionEnd() {
|
||||
console.log('transitiion end');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
/***/ })
|
||||
|
||||
/******/ });
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"component": true,
|
||||
"usingComponents": {}
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
<!-- slide-view/slide-view.wxml -->
|
||||
<wxs module="handler" src="./slideview.wxs"></wxs>
|
||||
<view class="weui-slideview weui-movable-view {{icon ? 'weui-slideview_icon' : ''}} {{extClass}}" style="width: 100%;height: 100%;">
|
||||
<view bindtransitionend="{{handler.transitionEnd}}"
|
||||
show="{{show}}" change:show="{{handler.showChange}}"
|
||||
rebounce="{{rebounce}}" change:rebounce="{{handler.rebounceChange}}"
|
||||
duration="{{duration}}" change:duration="{{handler.durationChange}}"
|
||||
change:disable="{{handler.disableChange}}" disable="{{disable}}"
|
||||
change:prop="{{handler.sizeReady}}" prop="{{size}}"
|
||||
bindtouchstart="{{handler.touchstart}}" bindtouchmove="{{handler.touchmove}}" bindtouchend="{{handler.touchend}}" class="weui-slideview__left left" style="width:100%;">
|
||||
<slot></slot>
|
||||
</view>
|
||||
<view class="weui-slideview__right right">
|
||||
<view class="weui-slideview__buttons" style="height:100%;width:100%;" wx:if="{{buttons && buttons.length}}">
|
||||
<view wx:for="{{buttons}}" class='btn weui-slideview__btn__wrp {{item.className}} {{item.extClass}}'>
|
||||
<view bindtap="{{handler.hideButton}}" data-data="{{item.data}}" data-index="{{index}}" class='weui-slideview__btn'>
|
||||
<text wx:if="{{!icon}}">{{item.text}}</text>
|
||||
<image class="weui-slideview__btn__icon" wx:else src="{{item.src}}"/>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
|
@ -0,0 +1,243 @@
|
|||
/* eslint-disable */
|
||||
var touchstart = function(event, ownerInstance) {
|
||||
var ins = event.instance
|
||||
var st = ins.getState()
|
||||
if (st.disable) return // disable的逻辑
|
||||
// console.log('touchstart st', JSON.stringify(st))
|
||||
if (!st.size) return
|
||||
// console.log('touchstart', JSON.stringify(event))
|
||||
st.isMoving = true
|
||||
st.startX = event.touches[0].pageX
|
||||
st.startY = event.touches[0].pageY
|
||||
st.firstAngle = 0
|
||||
}
|
||||
var touchmove = function(event, ownerInstance) {
|
||||
var ins = event.instance
|
||||
var st = ins.getState()
|
||||
if (!st.size || !st.isMoving) return
|
||||
// console.log('touchmove', JSON.stringify(event))
|
||||
var pagex = event.touches[0].pageX - st.startX
|
||||
var pagey = event.touches[0].pageY - st.startY
|
||||
// 左侧45度角为界限,大于45度则允许水平滑动
|
||||
if (st.firstAngle === 0) {
|
||||
st.firstAngle = Math.abs(pagex) - Math.abs(pagey)
|
||||
}
|
||||
if (st.firstAngle < 0) {
|
||||
return
|
||||
}
|
||||
var movex = pagex > 0 ? Math.min(st.max, pagex) : Math.max(-st.max, pagex)
|
||||
// 往回滑动的情况
|
||||
if (st.out) {
|
||||
// 已经是划出来了,还要往左滑动,忽略
|
||||
if (movex < 0) return
|
||||
ins.setStyle({
|
||||
'transform': 'translateX(' + (st.transformx + movex) + 'px)',
|
||||
'transition': ''
|
||||
})
|
||||
var btns = ownerInstance.selectAllComponents('.btn')
|
||||
var transformTotal = 0
|
||||
var len = btns.length
|
||||
var i = len - 1;
|
||||
for (;i >= 0; i--) {
|
||||
var transform = st.size.buttons[i].width / st.max * movex
|
||||
var transformx = st.size.buttons[i].max - Math.min(st.size.buttons[i].max, transform + transformTotal)
|
||||
btns[i].setStyle({
|
||||
'transform': 'translateX(' + (-transformx) + 'px)',
|
||||
'transition': ''
|
||||
})
|
||||
transformTotal += transform
|
||||
}
|
||||
return false
|
||||
}
|
||||
if (movex > 0) movex = 0
|
||||
ins.setStyle({
|
||||
'transform': 'translateX(' + movex + 'px)',
|
||||
'transition': ''
|
||||
})
|
||||
st.transformx = movex
|
||||
var btns = ownerInstance.selectAllComponents('.btn')
|
||||
var transformTotal = 0
|
||||
var len = btns.length
|
||||
var i = len - 1;
|
||||
for (;i >= 0; i--) {
|
||||
var transform = st.size.buttons[i].width / st.max * movex
|
||||
var transformx = Math.max(-st.size.buttons[i].max, transform + transformTotal)
|
||||
btns[i].setStyle({
|
||||
'transform': 'translateX(' + transformx + 'px)',
|
||||
'transition': ''
|
||||
})
|
||||
st.size.buttons[i].transformx = transformx
|
||||
transformTotal += transform
|
||||
}
|
||||
return false // 禁止垂直方向的滑动
|
||||
}
|
||||
var touchend = function(event, ownerInstance) {
|
||||
var ins = event.instance
|
||||
var st = ins.getState()
|
||||
if (!st.size || !st.isMoving) return
|
||||
// 左侧45度角为界限,大于45度则允许水平滑动
|
||||
if (st.firstAngle < 0) {
|
||||
return
|
||||
}
|
||||
var duration = st.duration / 1000
|
||||
st.isMoving = false
|
||||
// console.log('touchend', JSON.stringify(event))
|
||||
var btns = ownerInstance.selectAllComponents('.btn')
|
||||
var len = btns.length
|
||||
var i = len - 1
|
||||
// console.log('len size', len)
|
||||
if (Math.abs(event.changedTouches[0].pageX - st.startX) < st.throttle || event.changedTouches[0].pageX - st.startX > 0) { // 方向也要控制
|
||||
st.out = false
|
||||
ins.setStyle({
|
||||
'transform': 'translate3d(0px, 0, 0)',
|
||||
'transition': 'transform ' + (duration) + 's'
|
||||
})
|
||||
for (;i >= 0; i--) {
|
||||
btns[i].setStyle({
|
||||
'transform': 'translate3d(0px, 0, 0)',
|
||||
'transition': 'transform ' + (duration) + 's'
|
||||
})
|
||||
}
|
||||
ownerInstance.callMethod('hide')
|
||||
return
|
||||
}
|
||||
showButtons(ins, ownerInstance, duration)
|
||||
ownerInstance.callMethod('show')
|
||||
}
|
||||
var REBOUNCE_TIME = 0.2
|
||||
var showButtons = function(ins, ownerInstance, withDuration) {
|
||||
var st = ins.getState()
|
||||
if (!st.size) return
|
||||
var rebounceTime = st.rebounce ? REBOUNCE_TIME : 0
|
||||
var movex = st.max
|
||||
st.out = true
|
||||
var btns = ownerInstance.selectAllComponents('.btn')
|
||||
var rebounce = st.rebounce || 0
|
||||
var len = btns.length
|
||||
var i = len - 1
|
||||
ins.setStyle({
|
||||
'transform': 'translate3d(' + (-movex - rebounce) + 'px, 0, 0)',
|
||||
'transition': 'transform ' + (withDuration) + 's'
|
||||
})
|
||||
st.transformx = -movex
|
||||
var transformTotal = 0
|
||||
for (;i >= 0; i--) {
|
||||
var transform = st.size.buttons[i].width / st.max * movex
|
||||
var transformx = (-(transform + transformTotal))
|
||||
btns[i].setStyle({
|
||||
'transform': 'translate3d(' + transformx + 'px, 0, 0)',
|
||||
'transition': 'transform ' + (withDuration ? withDuration + rebounceTime : withDuration) + 's'
|
||||
})
|
||||
st.size.buttons[i].transformx = transformx
|
||||
transformTotal += transform
|
||||
}
|
||||
}
|
||||
var innerHideButton = function(ownerInstance) {
|
||||
var ins = ownerInstance.selectComponent('.left')
|
||||
var st = ins.getState()
|
||||
if (!st.size) return
|
||||
var duration = st.duration ? st.duration / 1000 : 0
|
||||
var btns = ownerInstance.selectAllComponents('.btn')
|
||||
var len = btns.length
|
||||
var i = len - 1
|
||||
ins.setStyle({
|
||||
'transform': 'translate3d(0px, 0, 0)',
|
||||
'transition': 'transform ' + (duration) + 's'
|
||||
})
|
||||
st.transformx = 0
|
||||
for (;i >= 0; i--) {
|
||||
btns[i].setStyle({
|
||||
'transform': 'translate3d(0px, 0, 0)',
|
||||
'transition': 'transform ' + (duration) + 's'
|
||||
})
|
||||
st.size.buttons[i].transformx = 0
|
||||
}
|
||||
}
|
||||
var hideButton = function(event, ownerInstance) {
|
||||
innerHideButton(ownerInstance)
|
||||
ownerInstance.callMethod('buttonTapByWxs', {index: event.currentTarget.dataset.index, data: event.currentTarget.dataset.data})
|
||||
return false
|
||||
}
|
||||
var sizeReady = function(newVal, oldVal, ownerInstance, ins) {
|
||||
var st = ins.getState()
|
||||
// st.disable = newVal && newVal.disable
|
||||
if (newVal && newVal.button && newVal.buttons) {
|
||||
st.size = newVal
|
||||
st.transformx = 0
|
||||
// var min = newVal.button.width
|
||||
var max = 0
|
||||
var len = newVal.buttons.length
|
||||
var i = newVal.buttons.length - 1;
|
||||
var total = 0
|
||||
for (; i >= 0; i--) {
|
||||
max += newVal.buttons[i].width
|
||||
// if (min > newVal.buttons[i]) {
|
||||
// min = newVal.buttons[i].width
|
||||
// }
|
||||
total += newVal.buttons[i].width
|
||||
newVal.buttons[i].max = total
|
||||
newVal.buttons[i].transformx = 0
|
||||
}
|
||||
st.throttle = st.size.throttle || 40 // 固定值
|
||||
st.rebounce = st.size.rebounce
|
||||
st.max = max
|
||||
ownerInstance.selectComponent('.right').setStyle({
|
||||
'line-height': newVal.button.height + 'px',
|
||||
left: (newVal.button.width) + 'px',
|
||||
width: max + 'px'
|
||||
})
|
||||
// console.log('st size', JSON.stringify(newVal))
|
||||
if (!st.size.disable && st.size.show) {
|
||||
showButtons(ins, ownerInstance)
|
||||
}
|
||||
}
|
||||
}
|
||||
var disableChange = function(newVal, oldVal, ownerInstance, ins) {
|
||||
var st = ins.getState()
|
||||
st.disable = newVal
|
||||
}
|
||||
var durationChange = function(newVal, oldVal, ownerInstance, ins) {
|
||||
var st = ins.getState()
|
||||
st.duration = newVal || 400
|
||||
}
|
||||
var showChange = function(newVal, oldVal, ownerInstance, ins) {
|
||||
var st = ins.getState()
|
||||
st.show = newVal
|
||||
if (st.disable) return
|
||||
// console.log('show change')
|
||||
if (st.show) {
|
||||
showButtons(ins, ownerInstance, st.duration)
|
||||
} else {
|
||||
innerHideButton(ownerInstance)
|
||||
}
|
||||
}
|
||||
var rebounceChange = function(newVal, oldVal, ownerInstance, ins) {
|
||||
var st = ins.getState()
|
||||
// console.log('rebounce', st.rebounce)
|
||||
st.rebounce = newVal
|
||||
}
|
||||
var transitionEnd = function(event, ownerInstance) {
|
||||
// console.log('transition')
|
||||
var ins = event.instance
|
||||
var st = ins.getState()
|
||||
// 回弹效果
|
||||
if (st.out && st.rebounce) {
|
||||
console.log('transition rebounce', st.rebounce)
|
||||
ins.setStyle({
|
||||
'transform': 'translate3d(' + (-st.max) + 'px, 0, 0)',
|
||||
'transition': 'transform ' + REBOUNCE_TIME +'s'
|
||||
})
|
||||
}
|
||||
}
|
||||
module.exports = {
|
||||
touchstart: touchstart,
|
||||
touchmove: touchmove,
|
||||
touchend: touchend,
|
||||
hideButton: hideButton,
|
||||
sizeReady: sizeReady,
|
||||
disableChange: disableChange,
|
||||
durationChange: durationChange,
|
||||
showChange: showChange,
|
||||
rebounceChange: rebounceChange,
|
||||
transitionEnd: transitionEnd
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
:host{width:100%}.weui-slideview{overflow:hidden;position:relative}.weui-slideview{position:relative}.weui-slideview__left{position:relative;z-index:10}.weui-slideview__right{position:absolute;z-index:1;left:100%;top:0;height:100%}.weui-slideview__btn__wrp{position:absolute;left:0;bottom:0;text-align:center;min-width:69px;height:100%;white-space:nowrap}.weui-slideview__btn{color:#FFFFFF;padding:0 17px}.weui-slideview__btn-group_default .weui-slideview__btn{background:#C7C7CC}.weui-slideview__btn-group_default~.weui-slideview__btn-group_default:before{content:" ";position:absolute;left:0;top:0;width:1px;bottom:0;border-left:1rpx solid #FFFFFF;color:#FFFFFF}.weui-slideview__btn-group_default:first-child:before{display:none}.weui-slideview__btn-group_warn .weui-slideview__btn{background:#FE3B30}.weui-slideview__btn-group_warn~.weui-slideview__btn-group_warn:before{content:" ";position:absolute;left:0;top:0;width:1px;bottom:0;border-left:1rpx solid #FFFFFF;color:#FFFFFF}.weui-slideview__btn-group_warn:first-child:before{display:none}.weui-slideview_icon .weui-slideview__btn__wrp{background:transparent;font-size:0}.weui-slideview_icon .weui-slideview__btn__wrp:after{content:"";width:0;height:100%;vertical-align:middle;display:inline-block}.weui-slideview_icon .weui-slideview__btn__wrp:first-child{padding-left:16px}.weui-slideview_icon .weui-slideview__btn__wrp:last-child{padding-right:8px}.weui-slideview_icon .weui-slideview__btn{width:48px;height:48px;line-height:48px;padding:0;display:inline-block;vertical-align:middle;border-radius:50%;background-color:#FFFFFF}.weui-slideview_icon .weui-slideview__btn__icon{display:inline-block;vertical-align:middle;width:22px;height:22px}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 987 B |
|
|
@ -0,0 +1,20 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="12px" height="24px" viewBox="0 0 12 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<!-- Generator: Sketch 52.2 (67145) - http://www.bohemiancoding.com/sketch -->
|
||||
<title>Icons/Filled/arrow Copy 2</title>
|
||||
<desc>Created with Sketch.</desc>
|
||||
<g id="05成员管理" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<g id="单个成员编辑" transform="translate(-25.000000, -54.000000)">
|
||||
<rect id="bg" x="0" y="0" width="375" height="236"></rect>
|
||||
<g id="Navbar">
|
||||
<g id="Group-4" transform="translate(8.000000, 50.000000)">
|
||||
<g id="Icons/Filled/arrow" transform="translate(23.000000, 16.000000) rotate(-180.000000) translate(-23.000000, -16.000000) translate(17.000000, 4.000000)" fill="#000000" fill-opacity="0.9">
|
||||
<g id="Group" transform="translate(-2.000000, 5.000000)">
|
||||
<path d="M3,2.5039609 L11,2.5039609 L11,4.5039609 L4,4.5039609 L4,11.5039609 L2,11.5039609 L2,3.5039609 C2,2.95167615 2.44771525,2.5039609 3,2.5039609 Z" id="图标颜色" transform="translate(6.500000, 7.003961) rotate(135.000000) translate(-6.500000, -7.003961) "></path>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.4 KiB |
|
|
@ -0,0 +1,131 @@
|
|||
module.exports =
|
||||
/******/ (function(modules) { // webpackBootstrap
|
||||
/******/ // The module cache
|
||||
/******/ var installedModules = {};
|
||||
/******/
|
||||
/******/ // The require function
|
||||
/******/ function __webpack_require__(moduleId) {
|
||||
/******/
|
||||
/******/ // Check if module is in cache
|
||||
/******/ if(installedModules[moduleId]) {
|
||||
/******/ return installedModules[moduleId].exports;
|
||||
/******/ }
|
||||
/******/ // Create a new module (and put it into the cache)
|
||||
/******/ var module = installedModules[moduleId] = {
|
||||
/******/ i: moduleId,
|
||||
/******/ l: false,
|
||||
/******/ exports: {}
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // Execute the module function
|
||||
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
||||
/******/
|
||||
/******/ // Flag the module as loaded
|
||||
/******/ module.l = true;
|
||||
/******/
|
||||
/******/ // Return the exports of the module
|
||||
/******/ return module.exports;
|
||||
/******/ }
|
||||
/******/
|
||||
/******/
|
||||
/******/ // expose the modules object (__webpack_modules__)
|
||||
/******/ __webpack_require__.m = modules;
|
||||
/******/
|
||||
/******/ // expose the module cache
|
||||
/******/ __webpack_require__.c = installedModules;
|
||||
/******/
|
||||
/******/ // define getter function for harmony exports
|
||||
/******/ __webpack_require__.d = function(exports, name, getter) {
|
||||
/******/ if(!__webpack_require__.o(exports, name)) {
|
||||
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
|
||||
/******/ }
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // define __esModule on exports
|
||||
/******/ __webpack_require__.r = function(exports) {
|
||||
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
||||
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||
/******/ }
|
||||
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // create a fake namespace object
|
||||
/******/ // mode & 1: value is a module id, require it
|
||||
/******/ // mode & 2: merge all properties of value into the ns
|
||||
/******/ // mode & 4: return value when already ns object
|
||||
/******/ // mode & 8|1: behave like require
|
||||
/******/ __webpack_require__.t = function(value, mode) {
|
||||
/******/ if(mode & 1) value = __webpack_require__(value);
|
||||
/******/ if(mode & 8) return value;
|
||||
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
|
||||
/******/ var ns = Object.create(null);
|
||||
/******/ __webpack_require__.r(ns);
|
||||
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
|
||||
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
|
||||
/******/ return ns;
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
||||
/******/ __webpack_require__.n = function(module) {
|
||||
/******/ var getter = module && module.__esModule ?
|
||||
/******/ function getDefault() { return module['default']; } :
|
||||
/******/ function getModuleExports() { return module; };
|
||||
/******/ __webpack_require__.d(getter, 'a', getter);
|
||||
/******/ return getter;
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // Object.prototype.hasOwnProperty.call
|
||||
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
||||
/******/
|
||||
/******/ // __webpack_public_path__
|
||||
/******/ __webpack_require__.p = "";
|
||||
/******/
|
||||
/******/
|
||||
/******/ // Load entry module and return exports
|
||||
/******/ return __webpack_require__(__webpack_require__.s = 16);
|
||||
/******/ })
|
||||
/************************************************************************/
|
||||
/******/ ({
|
||||
|
||||
/***/ 16:
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
|
||||
Component({
|
||||
options: {
|
||||
addGlobalClass: true
|
||||
},
|
||||
properties: {
|
||||
extClass: {
|
||||
type: String,
|
||||
value: ''
|
||||
},
|
||||
list: {
|
||||
type: Array,
|
||||
value: []
|
||||
},
|
||||
current: {
|
||||
type: Number,
|
||||
value: 0
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
tabChange: function tabChange(e) {
|
||||
var index = e.currentTarget.dataset.index;
|
||||
|
||||
if (index === this.data.current) {
|
||||
return;
|
||||
}
|
||||
this.setData({
|
||||
current: index
|
||||
});
|
||||
this.triggerEvent('change', { index: index, item: this.data.list[index] });
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
/***/ })
|
||||
|
||||
/******/ });
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"mp-badge": "../badge/badge"
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
<view class="weui-tabbar {{extClass}}">
|
||||
<!-- 选中的时候往weui-tabbar__item加class:weui-bar__item_on -->
|
||||
<view data-index='{{index}}' bindtap="tabChange" wx:for="{{list}}" class="weui-tabbar__item {{index === current ? 'weui-bar__item_on' : ''}}">
|
||||
<view style="position: relative;display:inline-block;">
|
||||
<image src="{{current === index ? item.selectedIconPath : item.iconPath}}" class="weui-tabbar__icon"></image>
|
||||
<mp-badge wx:if="{{item.badge}}" content="{{item.badge}}" style="position: absolute;top:-2px;left:calc(100% - 3px)"></mp-badge>
|
||||
</view>
|
||||
<view class="weui-tabbar__label">{{item.text}}</view>
|
||||
</view>
|
||||
</view>
|
||||
|
|
@ -0,0 +1 @@
|
|||
.weui-tabbar{display:flex;position:relative;z-index:500;background-color:#F7F7F7}.weui-tabbar:before{content:" ";position:absolute;left:0;top:0;right:0;height:1px;border-top:1rpx solid rgba(0,0,0,0.1);color:rgba(0,0,0,0.1)}.weui-tabbar__item{display:block;flex:1;padding:8px 0 4px;padding-bottom:calc(8px + constant(safe-area-inset-bottom));padding-bottom:calc(8px + env(safe-area-inset-bottom));font-size:0;color:rgba(0,0,0,0.5);text-align:center;-webkit-tap-highlight-color:rgba(0,0,0,0)}.weui-tabbar__item:first-child{padding-left:constant(safe-area-inset-left);padding-left:env(safe-area-inset-left)}.weui-tabbar__item:last-child{padding-right:constant(safe-area-inset-right);padding-right:env(safe-area-inset-right)}.weui-tabbar__item.weui-bar__item_on .weui-tabbar__icon,.weui-tabbar__item.weui-bar__item_on .weui-tabbar__icon>i,.weui-tabbar__item.weui-bar__item_on .weui-tabbar__label{color:#07C160}.weui-tabbar__icon{display:inline-block;width:28px;height:28px;margin-bottom:2px}i.weui-tabbar__icon,.weui-tabbar__icon>i{font-size:24px;color:rgba(0,0,0,0.5)}.weui-tabbar__icon image{width:100%;height:100%}.weui-tabbar__label{color:rgba(0,0,0,0.9);font-size:10px;line-height:1.4}
|
||||
|
|
@ -0,0 +1,170 @@
|
|||
module.exports =
|
||||
/******/ (function(modules) { // webpackBootstrap
|
||||
/******/ // The module cache
|
||||
/******/ var installedModules = {};
|
||||
/******/
|
||||
/******/ // The require function
|
||||
/******/ function __webpack_require__(moduleId) {
|
||||
/******/
|
||||
/******/ // Check if module is in cache
|
||||
/******/ if(installedModules[moduleId]) {
|
||||
/******/ return installedModules[moduleId].exports;
|
||||
/******/ }
|
||||
/******/ // Create a new module (and put it into the cache)
|
||||
/******/ var module = installedModules[moduleId] = {
|
||||
/******/ i: moduleId,
|
||||
/******/ l: false,
|
||||
/******/ exports: {}
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // Execute the module function
|
||||
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
||||
/******/
|
||||
/******/ // Flag the module as loaded
|
||||
/******/ module.l = true;
|
||||
/******/
|
||||
/******/ // Return the exports of the module
|
||||
/******/ return module.exports;
|
||||
/******/ }
|
||||
/******/
|
||||
/******/
|
||||
/******/ // expose the modules object (__webpack_modules__)
|
||||
/******/ __webpack_require__.m = modules;
|
||||
/******/
|
||||
/******/ // expose the module cache
|
||||
/******/ __webpack_require__.c = installedModules;
|
||||
/******/
|
||||
/******/ // define getter function for harmony exports
|
||||
/******/ __webpack_require__.d = function(exports, name, getter) {
|
||||
/******/ if(!__webpack_require__.o(exports, name)) {
|
||||
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
|
||||
/******/ }
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // define __esModule on exports
|
||||
/******/ __webpack_require__.r = function(exports) {
|
||||
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
||||
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||
/******/ }
|
||||
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // create a fake namespace object
|
||||
/******/ // mode & 1: value is a module id, require it
|
||||
/******/ // mode & 2: merge all properties of value into the ns
|
||||
/******/ // mode & 4: return value when already ns object
|
||||
/******/ // mode & 8|1: behave like require
|
||||
/******/ __webpack_require__.t = function(value, mode) {
|
||||
/******/ if(mode & 1) value = __webpack_require__(value);
|
||||
/******/ if(mode & 8) return value;
|
||||
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
|
||||
/******/ var ns = Object.create(null);
|
||||
/******/ __webpack_require__.r(ns);
|
||||
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
|
||||
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
|
||||
/******/ return ns;
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
||||
/******/ __webpack_require__.n = function(module) {
|
||||
/******/ var getter = module && module.__esModule ?
|
||||
/******/ function getDefault() { return module['default']; } :
|
||||
/******/ function getModuleExports() { return module; };
|
||||
/******/ __webpack_require__.d(getter, 'a', getter);
|
||||
/******/ return getter;
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // Object.prototype.hasOwnProperty.call
|
||||
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
||||
/******/
|
||||
/******/ // __webpack_public_path__
|
||||
/******/ __webpack_require__.p = "";
|
||||
/******/
|
||||
/******/
|
||||
/******/ // Load entry module and return exports
|
||||
/******/ return __webpack_require__(__webpack_require__.s = 13);
|
||||
/******/ })
|
||||
/************************************************************************/
|
||||
/******/ ({
|
||||
|
||||
/***/ 13:
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
|
||||
Component({
|
||||
options: {
|
||||
addGlobalClass: true
|
||||
},
|
||||
properties: {
|
||||
type: {
|
||||
type: String,
|
||||
value: 'error',
|
||||
observer: '_typeChange'
|
||||
},
|
||||
show: {
|
||||
type: Boolean,
|
||||
value: false,
|
||||
observer: '_showChange'
|
||||
},
|
||||
msg: {
|
||||
type: String,
|
||||
value: ''
|
||||
},
|
||||
delay: {
|
||||
type: Number,
|
||||
value: 2000
|
||||
},
|
||||
extClass: {
|
||||
type: String,
|
||||
value: ''
|
||||
}
|
||||
},
|
||||
data: {
|
||||
typeClassMap: {
|
||||
'warn': 'weui-toptips_warn',
|
||||
'info': 'weui-toptips_info',
|
||||
'success': 'weui-toptips_success',
|
||||
'error': 'weui-toptips_error'
|
||||
}
|
||||
},
|
||||
attached: function attached() {
|
||||
var data = this.data;
|
||||
this.setData({
|
||||
className: data.typeClassMap[data.type] || ''
|
||||
});
|
||||
},
|
||||
|
||||
methods: {
|
||||
_typeChange: function _typeChange(newVal) {
|
||||
this.setData({
|
||||
className: this.data.typeClassMap[newVal] || ''
|
||||
});
|
||||
return newVal;
|
||||
},
|
||||
_showChange: function _showChange(newVal) {
|
||||
this._showToptips(newVal);
|
||||
},
|
||||
_showToptips: function _showToptips(newVal) {
|
||||
var _this = this;
|
||||
|
||||
if (newVal && this.data.delay) {
|
||||
setTimeout(function () {
|
||||
_this.setData({
|
||||
show: false
|
||||
}, function () {
|
||||
_this.triggerEvent('hide', {}, {});
|
||||
});
|
||||
}, this.data.delay);
|
||||
}
|
||||
this.setData({
|
||||
show: newVal
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
/***/ })
|
||||
|
||||
/******/ });
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"component": true,
|
||||
"usingComponents": {}
|
||||
}
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
<view class="weui-toptips {{className}} {{extClass}} {{show ? 'weui-toptips_show' : ''}}">
|
||||
<block wx:if="{{msg}}">{{msg}}</block>
|
||||
<block wx:else>
|
||||
<slot></slot>
|
||||
</block>
|
||||
</view>
|
||||
|
|
@ -0,0 +1 @@
|
|||
.weui-toptips{position:fixed;-webkit-transform:translateZ(0) translateY(calc(-100% - 8px));transform:translateZ(0) translateY(calc(-100% - 8px));text-align:center;top:8px;left:16px;right:16px;border-radius:4px;padding:8px;-webkit-border-radius:4px;color:rgba(255,255,255,0.9);font-size:17px;line-height:1.4;background:rgba(250,81,81,0.9);z-index:5000;word-wrap:break-word;word-break:break-all;-webkit-transition:all .4s ease-in-out;transition:all .4s ease-in-out}.weui-toptips_show{-webkit-transform:translateZ(0) translateY(0);transform:translateZ(0) translateY(0);opacity:1}.weui-toptips_warn{background-color:#FA5151}.weui-toptips_success{background-color:#09BB07}.weui-toptips_error{background-color:#FA5151}.weui-toptips_info{background-color:#10AEFF}
|
||||
|
|
@ -0,0 +1,261 @@
|
|||
module.exports =
|
||||
/******/ (function(modules) { // webpackBootstrap
|
||||
/******/ // The module cache
|
||||
/******/ var installedModules = {};
|
||||
/******/
|
||||
/******/ // The require function
|
||||
/******/ function __webpack_require__(moduleId) {
|
||||
/******/
|
||||
/******/ // Check if module is in cache
|
||||
/******/ if(installedModules[moduleId]) {
|
||||
/******/ return installedModules[moduleId].exports;
|
||||
/******/ }
|
||||
/******/ // Create a new module (and put it into the cache)
|
||||
/******/ var module = installedModules[moduleId] = {
|
||||
/******/ i: moduleId,
|
||||
/******/ l: false,
|
||||
/******/ exports: {}
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // Execute the module function
|
||||
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
||||
/******/
|
||||
/******/ // Flag the module as loaded
|
||||
/******/ module.l = true;
|
||||
/******/
|
||||
/******/ // Return the exports of the module
|
||||
/******/ return module.exports;
|
||||
/******/ }
|
||||
/******/
|
||||
/******/
|
||||
/******/ // expose the modules object (__webpack_modules__)
|
||||
/******/ __webpack_require__.m = modules;
|
||||
/******/
|
||||
/******/ // expose the module cache
|
||||
/******/ __webpack_require__.c = installedModules;
|
||||
/******/
|
||||
/******/ // define getter function for harmony exports
|
||||
/******/ __webpack_require__.d = function(exports, name, getter) {
|
||||
/******/ if(!__webpack_require__.o(exports, name)) {
|
||||
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
|
||||
/******/ }
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // define __esModule on exports
|
||||
/******/ __webpack_require__.r = function(exports) {
|
||||
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
||||
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||
/******/ }
|
||||
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // create a fake namespace object
|
||||
/******/ // mode & 1: value is a module id, require it
|
||||
/******/ // mode & 2: merge all properties of value into the ns
|
||||
/******/ // mode & 4: return value when already ns object
|
||||
/******/ // mode & 8|1: behave like require
|
||||
/******/ __webpack_require__.t = function(value, mode) {
|
||||
/******/ if(mode & 1) value = __webpack_require__(value);
|
||||
/******/ if(mode & 8) return value;
|
||||
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
|
||||
/******/ var ns = Object.create(null);
|
||||
/******/ __webpack_require__.r(ns);
|
||||
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
|
||||
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
|
||||
/******/ return ns;
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
||||
/******/ __webpack_require__.n = function(module) {
|
||||
/******/ var getter = module && module.__esModule ?
|
||||
/******/ function getDefault() { return module['default']; } :
|
||||
/******/ function getModuleExports() { return module; };
|
||||
/******/ __webpack_require__.d(getter, 'a', getter);
|
||||
/******/ return getter;
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // Object.prototype.hasOwnProperty.call
|
||||
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
||||
/******/
|
||||
/******/ // __webpack_public_path__
|
||||
/******/ __webpack_require__.p = "";
|
||||
/******/
|
||||
/******/
|
||||
/******/ // Load entry module and return exports
|
||||
/******/ return __webpack_require__(__webpack_require__.s = 22);
|
||||
/******/ })
|
||||
/************************************************************************/
|
||||
/******/ ({
|
||||
|
||||
/***/ 22:
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
|
||||
Component({
|
||||
options: {
|
||||
addGlobalClass: true
|
||||
},
|
||||
properties: {
|
||||
title: {
|
||||
type: String,
|
||||
value: '图片上传'
|
||||
},
|
||||
sizeType: {
|
||||
type: Array,
|
||||
value: ['original', 'compressed']
|
||||
},
|
||||
sourceType: {
|
||||
type: Array,
|
||||
value: ['album', 'camera']
|
||||
},
|
||||
maxSize: {
|
||||
type: Number,
|
||||
value: 5 * 1024 * 1024
|
||||
},
|
||||
maxCount: {
|
||||
type: Number,
|
||||
value: 1
|
||||
},
|
||||
files: {
|
||||
type: Array,
|
||||
value: [],
|
||||
observer: function observer(newVal, oldVal, changedP) {
|
||||
this.setData({
|
||||
currentFiles: newVal
|
||||
});
|
||||
}
|
||||
},
|
||||
select: {
|
||||
type: Function,
|
||||
value: function value() {}
|
||||
},
|
||||
upload: {
|
||||
type: Function,
|
||||
value: null
|
||||
},
|
||||
tips: {
|
||||
type: String,
|
||||
value: ''
|
||||
},
|
||||
extClass: {
|
||||
type: String,
|
||||
value: ''
|
||||
},
|
||||
showDelete: {
|
||||
type: Boolean,
|
||||
value: true
|
||||
}
|
||||
},
|
||||
data: {
|
||||
currentFiles: [],
|
||||
showPreview: false,
|
||||
previewImageUrls: []
|
||||
},
|
||||
ready: function ready() {},
|
||||
|
||||
methods: {
|
||||
previewImage: function previewImage(e) {
|
||||
var index = e.currentTarget.dataset.index;
|
||||
|
||||
var previewImageUrls = [];
|
||||
this.data.files.map(function (item) {
|
||||
previewImageUrls.push(item.url);
|
||||
});
|
||||
this.setData({
|
||||
previewImageUrls: previewImageUrls,
|
||||
previewCurrent: index,
|
||||
showPreview: true
|
||||
});
|
||||
},
|
||||
chooseImage: function chooseImage(e) {
|
||||
var _this = this;
|
||||
|
||||
if (this.uploading) return;
|
||||
wx.chooseImage({
|
||||
count: this.data.maxCount - this.data.files.length,
|
||||
success: function success(res) {
|
||||
var invalidIndex = -1;
|
||||
res.tempFiles.forEach(function (item, index) {
|
||||
if (item.size > _this.data.maxSize) {
|
||||
invalidIndex = index;
|
||||
}
|
||||
});
|
||||
if (typeof _this.data.select === 'function') {
|
||||
var ret = _this.data.select(res);
|
||||
if (ret === false) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (invalidIndex >= 0) {
|
||||
_this.triggerEvent('fail', { type: 1, errMsg: 'chooseImage:fail size exceed ' + _this.data.maxSize, total: res.tempFilePaths.length, index: invalidIndex }, {});
|
||||
return;
|
||||
}
|
||||
var mgr = wx.getFileSystemManager();
|
||||
var contents = res.tempFilePaths.map(function (item) {
|
||||
var fileContent = mgr.readFileSync(item);
|
||||
return fileContent;
|
||||
});
|
||||
var obj = { tempFilePaths: res.tempFilePaths, tempFiles: res.tempFiles, contents: contents };
|
||||
_this.triggerEvent('select', obj, {});
|
||||
var files = res.tempFilePaths.map(function (item, i) {
|
||||
return { loading: true, url: 'data:image/jpg;base64,' + wx.arrayBufferToBase64(contents[i]) };
|
||||
});
|
||||
if (!files || !files.length) return;
|
||||
if (typeof _this.data.upload === 'function') {
|
||||
var len = _this.data.files.length;
|
||||
var newFiles = _this.data.files.concat(files);
|
||||
_this.setData({ files: newFiles, currentFiles: newFiles });
|
||||
_this.loading = true;
|
||||
_this.data.upload(obj).then(function (json) {
|
||||
_this.loading = false;
|
||||
if (json.urls) {
|
||||
var oldFiles = _this.data.files;
|
||||
json.urls.forEach(function (url, index) {
|
||||
oldFiles[len + index].url = url;
|
||||
oldFiles[len + index].loading = false;
|
||||
});
|
||||
_this.setData({ files: oldFiles, currentFiles: newFiles });
|
||||
_this.triggerEvent('success', json, {});
|
||||
} else {
|
||||
_this.triggerEvent('fail', { type: 3, errMsg: 'upload file fail, urls not found' }, {});
|
||||
}
|
||||
}).catch(function (err) {
|
||||
_this.loading = false;
|
||||
var oldFiles = _this.data.files;
|
||||
res.tempFilePaths.map(function (item, index) {
|
||||
oldFiles[len + index].error = true;
|
||||
oldFiles[len + index].loading = false;
|
||||
});
|
||||
_this.setData({ files: oldFiles, currentFiles: newFiles });
|
||||
_this.triggerEvent('fail', { type: 3, errMsg: 'upload file fail', error: err }, {});
|
||||
});
|
||||
}
|
||||
},
|
||||
fail: function fail(_fail) {
|
||||
if (_fail.errMsg.indexOf('chooseImage:fail cancel') >= 0) {
|
||||
_this.triggerEvent('cancel', {}, {});
|
||||
return;
|
||||
}
|
||||
_fail.type = 2;
|
||||
_this.triggerEvent('fail', _fail, {});
|
||||
}
|
||||
});
|
||||
},
|
||||
deletePic: function deletePic(e) {
|
||||
var index = e.detail.index;
|
||||
var files = this.data.files;
|
||||
var file = files.splice(index, 1);
|
||||
this.setData({
|
||||
files: files,
|
||||
currentFiles: files
|
||||
});
|
||||
this.triggerEvent('delete', { index: index, item: file[0] });
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
/***/ })
|
||||
|
||||
/******/ });
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"mp-gallery": "../gallery/gallery"
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
<view class="weui-uploader {{extClass}}">
|
||||
<view class="weui-uploader__hd">
|
||||
<div class="weui-uploader__overview">
|
||||
<view class="weui-uploader__title">{{title}}</view>
|
||||
<view class="weui-uploader__info" wx:if="{{maxCount > 1}}">{{currentFiles.length}}/{{maxCount}}</view>
|
||||
|
||||
</div>
|
||||
<view wx:if="{{tips}}" class="weui-uploader__tips">{{tips}}</view>
|
||||
<view wx:else><slot name="tips"></slot></view>
|
||||
</view>
|
||||
<view class="weui-uploader__bd">
|
||||
<view class="weui-uploader__files">
|
||||
<block wx:for="{{currentFiles}}" wx:key="*this">
|
||||
<view wx:if="{{item.error}}" data-index="{{index}}" bindtap="previewImage" class="weui-uploader__file weui-uploader__file_status">
|
||||
<image class="weui-uploader__img" src="{{item.url}}" mode="aspectFill" />
|
||||
<view class="weui-uploader__file-content">
|
||||
<icon type="warn" size="23" color="#F43530"></icon>
|
||||
</view>
|
||||
</view>
|
||||
<view wx:elif="{{item.loading}}" data-index="{{index}}" bindtap="previewImage" class="weui-uploader__file weui-uploader__file_status">
|
||||
<image class="weui-uploader__img" src="{{item.url}}" mode="aspectFill" />
|
||||
<view class="weui-uploader__file-content">
|
||||
<view class="weui-loading"></view>
|
||||
</view>
|
||||
</view>
|
||||
<view wx:else class="weui-uploader__file" data-index="{{index}}" bindtap="previewImage">
|
||||
<image class="weui-uploader__img" src="{{item.url}}" mode="aspectFill" />
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
<view wx:if="{{currentFiles.length < maxCount}}" class="weui-uploader__input-box">
|
||||
<view class="weui-uploader__input" bindtap="chooseImage"></view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<mp-gallery hide-on-click="{{true}}" show-delete="{{showDelete}}" show="{{showPreview}}" binddelete="deletePic" img-urls="{{previewImageUrls}}" current="{{previewCurrent}}"></mp-gallery>
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"requires": true,
|
||||
"lockfileVersion": 1,
|
||||
"dependencies": {
|
||||
"weui-miniprogram": {
|
||||
"version": "0.2.1",
|
||||
"resolved": "https://registry.npmjs.org/weui-miniprogram/-/weui-miniprogram-0.2.1.tgz",
|
||||
"integrity": "sha512-Of/r4QwmlzMwvpW9BQHcL/KW3WV5kw+7yxCFSob3UIqMpwLxKHuBrQajuCVkM3CbqxIpc0XWyDYnpCWk3VkLYg=="
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
"name": "aqyj",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "app.js",
|
||||
"dependencies": {
|
||||
"weui-miniprogram": "^0.2.1"
|
||||
},
|
||||
"devDependencies": {},
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://e.coding.net/ctcdevteam/aqyj.git"
|
||||
},
|
||||
"author": "",
|
||||
"license": "ISC"
|
||||
}
|
||||
|
|
@ -5,7 +5,9 @@ Page({
|
|||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
|
||||
username:'',
|
||||
password:'',
|
||||
mpopenid:''
|
||||
},
|
||||
usernameChange: function (e) {
|
||||
this.data.username = e.detail.value
|
||||
|
|
@ -15,11 +17,11 @@ Page({
|
|||
},
|
||||
denglu: function(){
|
||||
var that=this
|
||||
console.log(that.data)
|
||||
// console.log(that.data)
|
||||
wx.request({
|
||||
url: getApp().globalData.serverUrl + 'bindmp',
|
||||
header: {
|
||||
'content-type': 'application/x-www-form-urlencoded', //
|
||||
'content-type': 'application/json', //
|
||||
},
|
||||
method: 'POST',
|
||||
data:that.data,
|
||||
|
|
@ -27,6 +29,16 @@ Page({
|
|||
if (res.statusCode === 200) {
|
||||
if (res.data.code == 1) {
|
||||
wx.showToast({})
|
||||
wx.removeStorageSync('sessionid')
|
||||
getApp().globalData.userInfo = {
|
||||
userid: 0,
|
||||
username: '',
|
||||
name: '',
|
||||
isaqy: 0,
|
||||
mpopenid: '',
|
||||
companyid: '',
|
||||
perms: []
|
||||
} //重置globaldata和session
|
||||
getApp().mplogin()
|
||||
wx.switchTab({
|
||||
url: '/pages/main/main',
|
||||
|
|
@ -42,13 +54,18 @@ Page({
|
|||
}
|
||||
});
|
||||
},
|
||||
|
||||
onGetInfo:function(e){
|
||||
this.setData({
|
||||
userInfo:e.detail.userInfo
|
||||
})
|
||||
this.denglu()
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
this.setData({
|
||||
mpopenid:wx.getStorageSync('mpopenid')
|
||||
mpopenid:getApp().globalData.userInfo.mpopenid
|
||||
})
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -20,12 +20,13 @@
|
|||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<button class="weui-btn" type="primary" bindtap="denglu">登陆并绑定</button>
|
||||
<button class="weui-btn" type="primary" open-type="getUserInfo" bindgetuserinfo="onGetInfo">授权并绑定登陆</button>
|
||||
</view>
|
||||
<view class="weui-footer weui-footer_fixed-bottom">
|
||||
<!-- <view class="weui-footer__links">
|
||||
<navigator url="" class="weui-footer__link">WeUI首页</navigator>
|
||||
</view> -->
|
||||
<view class="weui-footer__text" bindtap="intro">点击下载系统/小程序文档介绍</view>
|
||||
<view class="weui-footer__text">Copyright © 2018-2019 国检集团</view>
|
||||
<view class="weui-footer__text">Copyright © 2018-2020 国检集团</view>
|
||||
<view class="weui-footer__text">中存大数据提供技术支持</view>
|
||||
</view>
|
||||
|
|
@ -0,0 +1,162 @@
|
|||
// pages/suggest/detail.js
|
||||
var util = require('../../utils/util.js')
|
||||
Page({
|
||||
openfj: function (e) {
|
||||
var that = this
|
||||
let fileurl = that.data.url
|
||||
wx.showLoading({
|
||||
title: '正在下载...',
|
||||
})
|
||||
wx.downloadFile({
|
||||
url: fileurl,
|
||||
success(res) {
|
||||
wx.showLoading({
|
||||
title: '成功,正在打开...',
|
||||
})
|
||||
const filePath = res.tempFilePath
|
||||
console.log(filePath)
|
||||
var filetype
|
||||
if (fileurl.indexOf(".docx") != -1) {
|
||||
filetype = 'docx'
|
||||
}
|
||||
else if (fileurl.indexOf(".doc") != -1) {
|
||||
filetype = 'doc'
|
||||
}
|
||||
else if (fileurl.indexOf(".xlsx") != -1) {
|
||||
filetype = 'xlsx'
|
||||
}
|
||||
else if (fileurl.indexOf(".xls") != -1) {
|
||||
filetype = 'xls'
|
||||
}
|
||||
else if (fileurl.indexOf(".pptx") != -1) {
|
||||
filetype = 'pptx'
|
||||
}
|
||||
else if (fileurl.indexOf(".ppt") != -1) {
|
||||
filetype = 'ppt'
|
||||
}
|
||||
else if (fileurl.indexOf(".pdf") != -1) {
|
||||
filetype = 'pdf'
|
||||
}else{
|
||||
wx.hideLoading()
|
||||
return
|
||||
}
|
||||
wx.openDocument({
|
||||
filePath,
|
||||
fileType: filetype,
|
||||
success(res) {
|
||||
wx.hideLoading()
|
||||
console.log('打开文档成功')
|
||||
}, fail: function (e) {
|
||||
console.log(e)
|
||||
}
|
||||
})
|
||||
that.hasRead()
|
||||
}
|
||||
})
|
||||
|
||||
},
|
||||
hasRead:function(){
|
||||
wx.request({
|
||||
url: this.data.serverUrl + 'edu/api?a=downfile&id=' + this.data.id,
|
||||
header: {
|
||||
'content-type': 'application/json', // 默认值
|
||||
'Cookie': wx.getStorageSync("sessionid"),
|
||||
},
|
||||
data: {
|
||||
},
|
||||
success: res => {
|
||||
}
|
||||
});
|
||||
},
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
serverUrl: getApp().globalData.serverUrl,
|
||||
isDocument:false
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
this.getFiledetail(options.id);
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage: function () {
|
||||
|
||||
},
|
||||
getFiledetail: function (id) {
|
||||
wx.showLoading({
|
||||
title: '加载中',
|
||||
}),
|
||||
wx.request({
|
||||
url: this.data.serverUrl + 'edu/api?a=detail&id=' + id,
|
||||
header: {
|
||||
'content-type': 'application/json', // 默认值
|
||||
'Cookie': wx.getStorageSync("sessionid"),
|
||||
},
|
||||
data: {
|
||||
},
|
||||
success: res => {
|
||||
wx.hideLoading();
|
||||
console.log(res.data);
|
||||
if (res.statusCode === 200) {
|
||||
var filedetail = res.data
|
||||
filedetail.url = this.data.serverUrl + filedetail.url
|
||||
this.setData(filedetail)
|
||||
if([2,3,4,5].indexOf(filedetail.type)!=-1){
|
||||
this.setData({
|
||||
isDocument:true
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
})
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"usingComponents": {},
|
||||
"navigationBarTitleText": "文件详情"
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
<view class="page">
|
||||
<view class="page__bd">
|
||||
<view class="weui-article">
|
||||
<view class="weui-article__h1">{{title}}</view>
|
||||
<view class="weui-article__h2">分享者:
|
||||
<span style="color:blue;font-weight:bold">{{user__ubelongpart__partname}}</span>
|
||||
<span style="color:orange;font-weight:bold"> {{user__name}}</span>
|
||||
</view>
|
||||
<view class="weui-media-box__desc">下载量:
|
||||
<span style="color:blue;font-weight:bold">{{downnum}}</span>
|
||||
</view>
|
||||
<view class="weui-media-box__desc">最近编辑时间:{{modifytime}}
|
||||
</view>
|
||||
</view>
|
||||
<view class="weui-article">
|
||||
<view class="weui-article__section">
|
||||
<span> </span>
|
||||
{{desciption}}
|
||||
</view>
|
||||
</view>
|
||||
<view class="weui-article__p" style="text-align:center">
|
||||
<!-- <image wx:if="{{type==1}}" src="../images/mp4.svg"></image> -->
|
||||
<video wx:if="{{type==1}}" src="{{url}}" controls title="{{title}}" bindplay="hasRead" icon="{{poster}}"></video>
|
||||
<image wx:elif="{{type==2}}" src="../images/word.svg"></image>
|
||||
<image wx:elif="{{type==3}}" src="../images/ppt.svg"></image>
|
||||
<image wx:elif="{{type==4}}" src="../images/pdf.svg"></image>
|
||||
<image wx:elif="{{type==5}}" src="../images/excel.svg"></image>
|
||||
<image wx:elif="{{type==6}}" src="../images/zip.svg"></image>
|
||||
<image wx:else src="../images/file.svg"></image>
|
||||
</view>
|
||||
<button class="weui-btn" type="primary" bindtap="openfj" wx:if="{{isDocument}}">点击查看/下载</button>
|
||||
</view>
|
||||
</view>
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
/* pages/data/detail.wxss */
|
||||
.weui-btn{
|
||||
width:auto;
|
||||
margin: 5px;
|
||||
}
|
||||
|
|
@ -0,0 +1,136 @@
|
|||
// pages/miss/miss.js
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
page: 1,
|
||||
serverUrl: getApp().globalData.serverUrl,
|
||||
datalist: []
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function () {
|
||||
var that = this;
|
||||
that.getDatalist(1)
|
||||
this.data.page = 1;
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh: function () {
|
||||
var that = this;
|
||||
that.getDatalist(1);
|
||||
wx.stopPullDownRefresh();
|
||||
this.data.page = 1;
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom: function () {
|
||||
//上拉分页,将页码加1,然后调用分页函数
|
||||
this.data.page = this.data.page + 1;
|
||||
this.getDatalist();
|
||||
wx.stopPullDownRefresh();
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage: function () {
|
||||
|
||||
},
|
||||
getDatalist: function (page,search='') {
|
||||
var that = this;
|
||||
if (page != 1) { page = that.data.page }
|
||||
wx.showLoading({
|
||||
title: '加载中',
|
||||
}),
|
||||
wx.request({
|
||||
url: this.data.serverUrl + 'edu/api?a=listall&rows=10&page=' + page+'&search='+search,
|
||||
header: {
|
||||
'content-type': 'application/json', // 默认值
|
||||
'Cookie': wx.getStorageSync("sessionid"),
|
||||
},
|
||||
success: res => {
|
||||
if (res.statusCode === 200) {
|
||||
if (res.data.rows.length == 0) {
|
||||
if (page == 1) {
|
||||
this.setData({
|
||||
total: 0,
|
||||
datalist: []
|
||||
})
|
||||
}
|
||||
else {
|
||||
wx.showModal({
|
||||
content: "已经到底啦!",
|
||||
showCancel: false,
|
||||
confirmText: "确定",
|
||||
})
|
||||
}
|
||||
} else {
|
||||
let list
|
||||
if (page == 1) {
|
||||
list = res.data.rows
|
||||
} else {
|
||||
list = this.data.datalist.concat(res.data.rows)
|
||||
}
|
||||
this.setData({
|
||||
total: res.data.total,
|
||||
datalist: list
|
||||
})
|
||||
}
|
||||
}
|
||||
wx.hideLoading();
|
||||
}
|
||||
});
|
||||
},
|
||||
//搜索框文本内容显示
|
||||
inputBind: function (event) {
|
||||
this.setData({
|
||||
inputValue: event.detail.value
|
||||
})
|
||||
},
|
||||
query: function(){
|
||||
this.page = 1
|
||||
this.getDatalist(this.page,this.data.inputValue)
|
||||
},
|
||||
reset: function(){
|
||||
this.page = 1
|
||||
this.inputValue = ''
|
||||
this.getDatalist(this.page)
|
||||
}
|
||||
})
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"navigationBarTitleText": "资料",
|
||||
"enablePullDownRefresh": true,
|
||||
"onReachBottomDistance": 50
|
||||
}
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
<view class="page__bd">
|
||||
|
||||
<view class="head">共{{total}}条资料</view>
|
||||
<view class='search'>
|
||||
<input type='text' placeholder='输入你想要的内容' confirm-type='search' value="{{inputValue}}" bindinput='inputBind' bindconfirm='query' style="flex: 1;"></input>
|
||||
<view style="padding:2rpx">
|
||||
<button type="primary" size="{{mini}}" bindtap="query" >查询</button>
|
||||
</view>
|
||||
<view style="padding:2rpx">
|
||||
<button type="primary" size="{{mini}}" bindtap="reset" >重置</button>
|
||||
</view>
|
||||
</view>
|
||||
<!-- <view style="display:flex;">
|
||||
<input class="weui-input" bindinput="bindSearchword" placeholder="输入名称进行搜索"/>
|
||||
<view style="width:auto;padding:2rpx">
|
||||
<button type="primary" size="{{mini}}" bindtap="search">查询</button>
|
||||
</view>
|
||||
<view style="width:auto;padding:2rpx">
|
||||
<button type="primary" size="{{mini}}" bindtap="reset">重置</button>
|
||||
</view>
|
||||
</view> -->
|
||||
<view class="weui-cells weui-cells_after-title" >
|
||||
<block wx:for="{{datalist}}" wx:key="unique">
|
||||
<navigator url="./detail?id={{item.id}}" class="weui-media-box weui-media-box_appmsg" hover-class="weui-cell_active">
|
||||
<view class="weui-media-box__hd weui-media-box__hd_in-appmsg">
|
||||
<image wx:if="{{item.type==1}}" class="weui-media-box__thumb" src="../images/mp4.svg"></image>
|
||||
<image wx:elif="{{item.type==2}}" class="weui-media-box__thumb" src="../images/word.svg"></image>
|
||||
<image wx:elif="{{item.type==3}}" class="weui-media-box__thumb" src="../images/ppt.svg"></image>
|
||||
<image wx:elif="{{item.type==4}}" class="weui-media-box__thumb" src="../images/pdf.svg"></image>
|
||||
<image wx:elif="{{item.type==5}}" class="weui-media-box__thumb" src="../images/excel.svg"></image>
|
||||
<image wx:elif="{{item.type==6}}" class="weui-media-box__thumb" src="../images/zip.svg"></image>
|
||||
<image wx:else class="weui-media-box__thumb" src="../pages/image/file.svg"></image>
|
||||
</view>
|
||||
<view class="weui-media-box__bd weui-media-box__bd_in-appmsg">
|
||||
<view class="weui-media-box__title">{{item.title}}</view>
|
||||
<view class="weui-media-box__desc">{{item.user__ubelongpart__partname}} {{item.user__name}}分享</view>
|
||||
<view class="weui-media-box__desc">类别:{{item.cate__name}}</view>
|
||||
<view class="weui-media-box__desc">最新编辑:{{item.modifytime}}</view>
|
||||
</view>
|
||||
<view class="weui-panel__ft weui-cell__ft_in-access">
|
||||
<view class="weui-media-box__title">
|
||||
<span wx:if="{{item.type==1}}">播放量</span>
|
||||
<span wx:else>下载量</span>
|
||||
<span style="color:green;font-weight:bold"> {{item.downnum}}</span>
|
||||
</view>
|
||||
</view>
|
||||
</navigator>
|
||||
</block>
|
||||
</view>
|
||||
</view>
|
||||
<!-- <view style="position:fixed; bottom:0;width:100%;">
|
||||
<navigator url="/pages/miss/addmiss" hover-class="navigator-hover">
|
||||
<button class="weui-btn" type="primary">新增</button>
|
||||
</navigator>
|
||||
</view> -->
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
.weui-btn{
|
||||
width:auto;
|
||||
margin: 5px;
|
||||
}
|
||||
.container {
|
||||
background-color: #fff;
|
||||
color: #939393;
|
||||
}
|
||||
.head{
|
||||
color:#fff;
|
||||
background-color: cornflowerblue;
|
||||
text-align: center;
|
||||
}
|
||||
.search
|
||||
{
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
width:100%;
|
||||
height:auto;
|
||||
background-color:white;
|
||||
border:2rpx solid goldenrod;
|
||||
border-radius: 5rpx;
|
||||
|
||||
}
|
||||
|
||||
/* 搜索框提示文字样式 */
|
||||
.search input
|
||||
{
|
||||
padding-left:30rpx;
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue