初始化

This commit is contained in:
13410271814 2024-12-06 16:18:22 +08:00
commit 884dd70d83
751 changed files with 60883 additions and 0 deletions

View File

@ -0,0 +1,31 @@
/*
* Eslint config file
* Documentation: https://eslint.org/docs/user-guide/configuring/
* Install the Eslint extension before using this feature.
*/
module.exports = {
env: {
es6: true,
browser: true,
node: true,
},
ecmaFeatures: {
modules: true,
},
parserOptions: {
ecmaVersion: 2018,
sourceType: 'module',
},
globals: {
wx: true,
App: true,
Page: true,
getCurrentPages: true,
getApp: true,
Component: true,
requirePlugin: true,
requireMiniProgram: true,
},
// extends: 'eslint:recommended',
rules: {},
}

14
yunbainian/etms_wechat_mini/.gitignore vendored Normal file
View File

@ -0,0 +1,14 @@
# Windows
[Dd]esktop.ini
Thumbs.db
$RECYCLE.BIN/
# macOS
.DS_Store
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
# Node.js
node_modules/

View File

@ -0,0 +1,70 @@
const {
etmsPostTemp
} = require("./com");
App({
onLaunch(opts, data) {
this.etmsLogin("onLaunch");
},
onShow() {
if (!this.globalData.s) {
this.etmsLogin("onShow");
}
},
async etmsLogin(msg) {
if (this.globalData.islogin) {
return
} else {
// 登录
this.globalData.islogin = true
const data = await this.login();
}
},
async login() {
return new Promise((resolve, reject) => {
wx.login({
success: (res) => {
// 发送 res.code 到后台换取 openId, sessionKey, unionId
resolve(etmsPostTemp(
"openParent2/WxMiniLogin", {
code: res.code,
},
this.setLoginInfo,
))
},
});
})
},
setLoginInfo(res) {
this.globalData.s = res.s;
this.globalData.u = res.u;
this.globalData.openId = res.openId;
this.globalData.unionid = res.unionid;
this.globalData.nickName = res.nickName;
this.globalData.name = res.name;
this.globalData.avatarUrl = res.avatarUrl;
this.globalData.phone = res.phone;
if (res.avatarUrl) {
this.globalData.isGetUser = true;
}
},
globalData: {
islogin: false,
s: "",
u: "",
openId: "",
unionid: "",
nickName: "",
name: "",
avatarUrl: "",
isGetUser: false,
microWebHomeUrl: "https://baidu.com",
currentActivityBag: {},
currentActivityBag2: {},
},
});

View File

@ -0,0 +1,53 @@
{
"pages": [
"pages/index/index",
"pages/logs/logs",
"pages/my/index",
"pages/acdetail1/index",
"pages/acdetail2/index",
"pages/acdetail3/index",
"pages/activitySharing/index",
"pages/myReward/index",
"pages/gosubmitGroupPurchase/index",
"pages/goDistribution/index",
"pages/mywebsite/index",
"pages/routeItems/index",
"pages/explain/index",
"pages/gosubmitHaggling/index",
"pages/routeItems2/index",
"pages/hagglingItems/index",
"pages/distributionDesc/index",
"pages/earningsDetails/index",
"pages/acdetail4/index",
"pages/goSeckill/index",
"pages/accollect/index"
],
"window": {
"backgroundTextStyle": "light",
"navigationBarBackgroundColor": "#fff",
"navigationBarTitleText": "Weixin",
"navigationBarTextStyle": "black"
},
"tabBar": {
"color": "#7A7E83",
"selectedColor": "#FE053D",
"borderStyle": "black",
"backgroundColor": "#F7F7F7",
"list": [
{
"pagePath": "pages/index/index",
"iconPath": "image/activity0.png",
"selectedIconPath": "image/activity1.png",
"text": "我的活动"
},
{
"pagePath": "pages/my/index",
"iconPath": "image/my0.png",
"selectedIconPath": "image/my1.png",
"text": "个人中心"
}
]
},
"style": "v2",
"sitemapLocation": "sitemap.json"
}

View File

@ -0,0 +1,39 @@
/**app.wxss**/
@import "./utils/weui.wxss";
.container {
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
}
.etms_music {
position: fixed;
top: 15px;
left: 15px;
z-index: 9999;
}
.etms_input_phone_content {
display: flex;
}
.etms_input_phone_content_getphone {
padding: 0px !important;
margin: 0px !important;
width: 100px;
}
.ac-action {
position: absolute;
left: 50%;
transform: translateX(-50%);
display: inline-flex !important;
}
.t-popup__content {
margin-bottom: 110px;
}

View File

@ -0,0 +1,112 @@
const config = require("./config");
export function etmsPostTemp(rot, jsonData, callBack) {
var requestUrl = `${config.bascUrl}${rot}`;
return new Promise((resolve, reject) => {
wx.request({
url: requestUrl,
data: jsonData,
method: "POST",
success(result) {
console.log(result);
if (result.data.code === "10000") {
callBack(result.data.resultData);
resolve()
} else {
wx.showToast({
title: result.data.message,
icon: "error",
duration: 2000,
});
}
},
fail({
errMsg
}) {
console.log("request fail", errMsg);
reject()
},
});
})
}
export function etmsPost(logininfo, rot, jsonData, callBack, failBack) {
var requestUrl = `${config.bascUrl}${rot}`;
wx.request({
url: requestUrl,
data: jsonData,
method: "POST",
header: {
"etms-s": logininfo.s,
"etms-l": logininfo.u,
"etms-o": logininfo.openId,
"etms-u": logininfo.unionid,
},
success(result) {
console.log(result);
if (result.data.code === "10000") {
callBack(result.data.resultData);
} else {
wx.showToast({
title: result.data.message,
icon: "none",
duration: 2000,
});
if (failBack) {
failBack(result.data);
}
}
},
fail({
errMsg
}) {
console.log("request fail", errMsg);
},
});
}
export function etmsPost2(logininfo, rot, jsonData, failBack) {
try {
var requestUrl = `${config.bascUrl}${rot}`;
console.log(123111)
return new Promise((resolve, reject) => {
wx.request({
url: requestUrl,
method: 'POST',
data: jsonData,
header: {
"etms-s": logininfo.s,
"etms-l": logininfo.u,
"etms-o": logininfo.openId,
"etms-u": logininfo.unionid,
},
success(res) {
console.log(123444)
if (res.statusCode === 200) {
if (res.data.code === "10000") {
resolve(res.data.resultData); // 成功时返回数据
} else {
wx.showToast({
title: res.data.message,
icon: "none",
duration: 2000,
});
if (failBack) {
failBack(res.data);
}
}
} else {
reject(new Error(`Server responded with status code ${res.statusCode}`));
}
},
fail(err) {
reject(new Error('Network error or request failed'));
}
});
});
} catch (ex) {
console.log(ex)
}
}

View File

@ -0,0 +1,181 @@
module.exports =
/** *** */ (function (modules) { // webpackBootstrap
/** *** */ // The module cache
/** *** */ const 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)
/** *** */ const 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
/** *** */ const ns = Object.create(null)
/** *** */ __webpack_require__.r(ns)
/** *** */ Object.defineProperty(ns, 'default', {enumerable: true, value})
/** *** */ if (mode & 2 && typeof value !== 'string') for (const 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) {
/** *** */ const 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__) {
Component({
options: {
multipleSlots: true,
// 在组件定义时的选项中启用多slot支持
addGlobalClass: true
},
properties: {
title: {
// 标题
type: String,
value: ''
},
showCancel: {
// 是否显示取消按钮
type: Boolean,
value: true
},
cancelText: {
// 取消按钮文案
type: String,
value: '取消'
},
maskClass: {
// 遮罩层class
type: String,
value: ''
},
extClass: {
// 弹出窗 class
type: String,
value: ''
},
maskClosable: {
// 点击遮罩 关闭 actionsheet
type: Boolean,
value: true
},
mask: {
// 是否需要 遮罩层
type: Boolean,
value: true
},
show: {
// 是否开启 actionsheet
type: Boolean,
value: false
},
actions: {
// actions 列表
type: Array,
value: [],
// {text, extClass}
observer: '_groupChange'
}
},
methods: {
_groupChange(e) {
// 支持 一维数组 写法
if (e.length > 0 && typeof e[0] !== 'string' && !(e[0] instanceof Array)) {
this.setData({
actions: [this.data.actions]
})
}
},
buttonTap(e) {
const {
value,
groupindex,
index
} = e.currentTarget.dataset
this.triggerEvent('actiontap', {
value,
groupindex,
index
})
},
closeActionSheet(e) {
const {
type
} = e.currentTarget.dataset
if (this.data.maskClosable || type) {
// 点击 action 里面的 取消
this.setData({
show: false
}) // 关闭回调事件
this.triggerEvent('close')
}
}
}
})
/***/ })
/** *** */ ]))

View File

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

View File

@ -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="index"
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="actionIndex"
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>

View File

@ -0,0 +1 @@
.weui-mask.weui-mask_hidden{opacity:0;transform:scale3d(1, 1, 0)}.weui-mask{opacity:1;transform:scale3d(1, 1, 1);transition:all .3s}

View File

@ -0,0 +1,17 @@
Component({
options: {
addGlobalClass: true
},
properties: {
extClass: {
type: String,
value: ''
},
content: {
type: String,
value: ''
}
}
})

View File

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

View File

@ -0,0 +1 @@
<view class="weui-badge {{extClass}} {{!content ? 'weui-badge_dot' : ''}}">{{content}}</view>

View File

@ -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}

View File

@ -0,0 +1,210 @@
module.exports =
/** *** */ (function (modules) { // webpackBootstrap
/** *** */ // The module cache
/** *** */ const 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)
/** *** */ const 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
/** *** */ const ns = Object.create(null)
/** *** */ __webpack_require__.r(ns)
/** *** */ Object.defineProperty(ns, 'default', {enumerable: true, value})
/** *** */ if (mode & 2 && typeof value !== 'string') for (const 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) {
/** *** */ const 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__) {
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(error) {
this.setData({
error: error || false
})
},
setInForm() {
this.setData({
inForm: true
})
},
setOuterClass(className) {
this.setData({
outerClass: className
})
},
navigateTo: function navigateTo() {
const data = this.data
if (data.url && data.link) {
wx.navigateTo({
url: data.url,
success: res => {
this.triggerEvent('navigatesuccess', res, {})
},
fail: fail => {
this.triggerEvent('navigateerror', fail, {})
}
})
}
}
}
})
/***/ })
/** *** */}))

View File

@ -0,0 +1,6 @@
{
"component": true,
"usingComponents": {
"mp-cells": "../cells/cells"
}
}

View File

@ -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>

View File

@ -0,0 +1 @@
.weui-cell_wxss.weui-cell_wxss:before{display:block}

View File

@ -0,0 +1,171 @@
module.exports =
/** *** */ (function (modules) { // webpackBootstrap
/** *** */ // The module cache
/** *** */ const 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)
/** *** */ const 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
/** *** */ const ns = Object.create(null)
/** *** */ __webpack_require__.r(ns)
/** *** */ Object.defineProperty(ns, 'default', {enumerable: true, value})
/** *** */ if (mode & 2 && typeof value !== 'string') for (const 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) {
/** *** */ const 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__) {
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(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(target) {
this.setData({
checkboxCount: this.data.checkboxCount + 1,
checkboxIsMulti: target.data.multi
})
},
unlinked(target) {
this.setData({
checkboxCount: this.data.checkboxCount - 1,
checkboxIsMulti: target.data.multi
})
}
}
},
methods: {
setCellMulti(multi) {
this.setData({
checkboxIsMulti: multi
})
},
setCellsClass(className) {
this.setData({
childClass: className
})
},
setOuterClass(className) {
this.setData({
outerClass: className
})
}
}
})
/***/ })
/** *** */}))

View File

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

View File

@ -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 {{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>

View File

@ -0,0 +1 @@
.weui-cells__group_wxss.weui-cells__group_wxss .weui-cells__title{margin-top:24px}.weui-cells__group_form .weui-cells__tips{margin-top:8px;padding:0 32px;color:var(--weui-FG-1)}

View File

@ -0,0 +1,196 @@
module.exports =
/** *** */ (function (modules) { // webpackBootstrap
/** *** */ // The module cache
/** *** */ const 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)
/** *** */ const 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
/** *** */ const ns = Object.create(null)
/** *** */ __webpack_require__.r(ns)
/** *** */ Object.defineProperty(ns, 'default', {enumerable: true, value})
/** *** */ if (mode & 2 && typeof value !== 'string') for (const 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) {
/** *** */ const 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__) {
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) {
let 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) {
const vals = []
this.data.targetList.forEach(function (item) {
if (item.data.checked) {
vals.push(item.data.value)
}
})
this.triggerEvent('change', {value: vals})
} else {
let 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() {
const 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
}
}
})
/***/ })
/** *** */}))

View File

@ -0,0 +1,6 @@
{
"component": true,
"usingComponents": {
"mp-cells": "../cells/cells"
}
}

View File

@ -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>

View File

@ -0,0 +1,165 @@
module.exports =
/** *** */ (function (modules) { // webpackBootstrap
/** *** */ // The module cache
/** *** */ const 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)
/** *** */ const 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
/** *** */ const ns = Object.create(null)
/** *** */ __webpack_require__.r(ns)
/** *** */ Object.defineProperty(ns, 'default', {enumerable: true, value})
/** *** */ if (mode & 2 && typeof value !== 'string') for (const 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) {
/** *** */ const 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__) {
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
})
},
setOuterClass: function setOuterClass(className) {
this.setData({
outerClass: className
})
},
checkedChange: function checkedChange(e) {
if (this.data.multi) {
const checked = !this.data.checked
this.setData({
checked
})
if (this.data.group) {
this.data.group.checkedChange(checked, this)
}
} else {
const _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})
}
}
})
/***/ })
/** *** */}))

View File

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

View File

@ -0,0 +1,20 @@
<mp-cell
has-footer="{{!multi}}"
has-header="{{multi}}"
bindtap="checkedChange"
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 class="weui-icon-checked"></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 class="weui-icon-checked"></icon>
</view>
</mp-cell>

View File

@ -0,0 +1 @@
.weui-cell_radio .weui-check+.weui-icon-checked{color:transparent}.weui-check[checked]+.weui-icon-checked{color:var(--weui-BRAND);-webkit-mask-image:url(data:image/svg+xml,%3Csvg%20width%3D%2224%22%20height%3D%2224%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M8.657%2018.435L3%2012.778l1.414-1.414%204.95%204.95L20.678%205l1.414%201.414-12.02%2012.021a1%201%200%2001-1.415%200z%22%20fill-rule%3D%22evenodd%22%2F%3E%3C%2Fsvg%3E);mask-image:url(data:image/svg+xml,%3Csvg%20width%3D%2224%22%20height%3D%2224%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M8.657%2018.435L3%2012.778l1.414-1.414%204.95%204.95L20.678%205l1.414%201.414-12.02%2012.021a1%201%200%2001-1.415%200z%22%20fill-rule%3D%22evenodd%22%2F%3E%3C%2Fsvg%3E)}

View File

@ -0,0 +1,209 @@
module.exports =
/** *** */ (function (modules) { // webpackBootstrap
/** *** */ // The module cache
/** *** */ const 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)
/** *** */ const 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
/** *** */ const ns = Object.create(null)
/** *** */ __webpack_require__.r(ns)
/** *** */ Object.defineProperty(ns, 'default', {enumerable: true, value})
/** *** */ if (mode & 2 && typeof value !== 'string') for (const 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) {
/** *** */ const 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 = 12)
/** *** */ }({
/***/ 12:
/***/ (function (module, exports, __webpack_require__) {
const _typeof = typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol' ? function (obj) { return typeof obj } : function (obj) { return obj && typeof Symbol === 'function' && obj.constructor === Symbol && obj !== Symbol.prototype ? 'symbol' : typeof obj }
Component({
properties: {
span: {
type: Number,
value: 24
},
offset: {
type: Number,
value: 0
},
push: {
type: Number,
value: -1
},
pull: {
type: Number,
value: -1
},
xs: {
type: Number,
optionalTypes: [Object],
value: -1
},
sm: {
type: Number,
optionalTypes: [Object],
value: -1
},
md: {
type: Number,
optionalTypes: [Object],
value: -1
},
lg: {
type: Number,
optionalTypes: [Object],
value: -1
},
xl: {
type: Number,
optionalTypes: [Object],
value: -1
}
},
data: {
classList: ['weui-col'],
gutter: 0,
paddingLeft: 0,
paddingRight: 0
},
relations: {
'../row/index': {
type: 'parent',
linked: function linked(target) {
this.data.gutter = Number(target.data.gutter)
this.updateGutter()
},
linkChanged: function linkChanged(target) {
this.data.gutter = Number(target.data.gutter)
this.updateGutter()
}
}
},
attached: function attached() {
this.updateCol()
},
methods: {
updateCol: function updateCol() {
const classList = ['weui-col']
let paddingLeft = void 0
let paddingRight = 0
classList.push('weui-col-' + this.data.span)
classList.push('weui-col-offset-' + this.data.offset)
if (this.data.gutter) {
paddingLeft = this.data.gutter / 2 + 'px'
paddingRight = paddingLeft
}
if (this.data.push !== -1) {
this.data.push && classList.push('weui-col-push-' + this.data.push)
}
if (this.data.pull !== -1) {
this.data.pull && classList.push('weui-col-pull-' + this.data.pull)
}
this.screenSizeSet('xs', classList)
this.screenSizeSet('sm', classList)
this.screenSizeSet('md', classList)
this.screenSizeSet('lg', classList)
this.screenSizeSet('xl', classList)
return this.setData({
classList
})
},
updateGutter: function updateGutter() {
let paddingLeft = void 0
let paddingRight = 0
if (this.data.gutter) {
paddingLeft = this.data.gutter / 2 + 'px'
paddingRight = paddingLeft
}
this.setData({
paddingLeft,
paddingRight
})
},
screenSizeSet: function screenSizeSet(screen, classList) {
if (typeof this.data[screen] === 'number' && this.data[screen] !== -1) {
classList.push('weui-col-' + screen + '-' + this.data[screen])
} else if (_typeof(this.data[screen]) === 'object') {
typeof this.data[screen].offset === 'number' && classList.push('weui-col-' + screen + '-offset-' + this.data[screen].offset)
typeof this.data[screen].span === 'number' && classList.push('weui-col-' + screen + '-' + this.data[screen].span)
}
}
}
})
/***/ })
/** *** */}))

View File

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

View File

@ -0,0 +1,3 @@
<view class="{{classList}}" style="padding-left:{{paddingLeft}};padding-right:{{paddingRight}}">
<slot></slot>
</view>

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,148 @@
const app = getApp();
const {
getWxml,
getStyle,
getWxml1,
getStyle1,
} = require("../../pages/activitySharing/poster-data.js");
const {
isCreateImageSuccess
} = require('../../utils/util.js')
Component({
options: {
},
properties: {
metaData: {
type: Object,
value: {}
},
},
data: {
isShowQrcode: false,
poster: null,
isShowPoster: false
},
observers: {
},
relations: {
},
lifetimes: {
},
methods: {
shareQr() {
wx.showShareImageMenu({
path: this.data.qrCode,
});
},
websiteClick() {
wx.navigateTo({
url: `/pages/mywebsite/index`,
})
},
showQrcode() {
this.getImg1();
},
shareFriend() {
wx.showShareImageMenu({
path: this.data.poster,
});
},
showPoster() {
this.getImg()
},
async getImg1() {
const obj = {
img: this.data.metaData.shareQRCode
}
console.log(obj);
const poster = this.selectComponent("#poster");
wx.showLoading({
title: '加载中',
})
setTimeout(() => {
const wxml = getWxml1(obj);
const style = getStyle1();
const p1 = poster.renderToCanvas({
wxml,
style
});
let container = null;
p1.then((res) => {
container = res;
return poster.canvasToTempFilePath();
}).then((res) => {
console.log(res, 'res');
this.setData({
qrCode: res.tempFilePath,
width: container.layoutBox.width,
height: container.layoutBox.height,
isShowQrcode: true
});
wx.hideLoading()
});
}, 500);
},
onVisibleChange2(e) {
this.setData({
isShowPoster: e.detail.visible,
});
},
onVisibleChange(e) {
this.setData({
isShowQrcode: e.detail.visible,
});
},
async getImg() {
var isPortraitSuccess = false;
if (app.globalData.avatarUrl && app.globalData.avatarUrl != '') {
try {
isPortraitSuccess = await isCreateImageSuccess(app.globalData.avatarUrl, "canvas", this);
} catch (ex) {
console.log(ex)
}
}
var obj = {
title: this.data.metaData.title,
img: this.data.metaData.imageCoverUrl,
portrait: isPortraitSuccess ? app.globalData.avatarUrl : "https://pxboss.xiaohebang.cn/system/material/mini/fx/avatar.png",
name: app.globalData.nickName,
qrcode: this.data.metaData.shareQRCode,
};
const poster = this.selectComponent("#poster");
wx.showLoading({
title: '加载中',
})
setTimeout(() => {
const wxml = getWxml(obj);
const style = getStyle();
const p1 = poster.renderToCanvas({
wxml,
style
});
console.log(p1);
let container = null;
p1.then((res) => {
container = res;
console.log(container);
return poster.canvasToTempFilePath();
}).then((res) => {
this.setData({
poster: res.tempFilePath,
width: container.layoutBox.width,
height: container.layoutBox.height,
isShowPoster: true
});
wx.hideLoading()
});
}, 500);
},
}
})

View File

@ -0,0 +1,8 @@
{
"component": true,
"usingComponents": {
"t-progress": "tdesign-miniprogram/progress/progress",
"t-popup": "tdesign-miniprogram/popup/popup",
"wxml-to-canvas": "wxml-to-canvas"
}
}

View File

@ -0,0 +1,38 @@
<t-popup visible="{{isShowQrcode}}" bind:visible-change="onVisibleChange" close-on-overlay-click="true" placement="center">
<view>
<image style="border-radius: 18px;" show-menu-by-longpress="{{true}}" src="{{metaData.shareQRCode}}" mode="widthFix"></image>
</view>
<button class="ac-action" bindtap="shareQr">
<image src="https://xiaohebang.oss-cn-beijing.aliyuncs.com/system/material/mini/fx/xz.png" />
<text>分享二维码</text>
</button>
</t-popup>
<t-popup visible="{{isShowPoster}}" bind:visible-change="onVisibleChange2" close-on-overlay-click="true" placement="center">
<view>
<image class="ac-poster-preview" src="{{poster}}" style="width: 300px;" mode="widthFix" show-menu-by-longpress />
</view>
<button class="ac-action" bindtap="shareFriend">
<image src="https://xiaohebang.oss-cn-beijing.aliyuncs.com/system/material/mini/fx/xz.png" />
<text>分享海报</text>
</button>
</t-popup>
<view class="btns">
<view bindtap="showQrcode" wx:if="{{metaData.shareQRCode}}" class="ac_ks_inter my_qrcode">
<image src="https://pxboss.xiaohebang.cn/system/material/mini/com/i-saoma.png" mode="aspectFit" />
</view>
<view class="ac_poster ac_ks_inter" bindtap="showPoster" wx:if="{{metaData}}">
<image src="https://pxboss.xiaohebang.cn/system/material/mini/com/poster1.png" mode="aspectFit" />
</view>
<view wx:if="{{metaData}}" bindtap="websiteClick" class="ac_wi_website ac_ks_inter" >
<image src="https://pxboss.xiaohebang.cn/system/material/mini/com/micsite1.png" mode="aspectFit" />
</view>
<!-- <view bindtap="phoneClick" data-phoneNumber="{{.globalPhone}}" wx:if="{{activityBag.bascInfo.globalPhone}}" class="ac_ks_inter ac_link_phone">
<image src="https://pxboss.xiaohebang.cn/system/material/mini/com/i-phone.png" mode="aspectFit" />
</view> -->
</view>
<canvas canvas-id="canvas" id="canvas" type="2d" style="position: fixed; left: -100%" />
<wxml-to-canvas id="poster" class="ac-poster-canvas" width="300" height="600"></wxml-to-canvas>

View File

@ -0,0 +1,51 @@
/* components/comPart/compart.wxss */
.btns {
position: fixed;
z-index: 999;
right: 10px;
bottom: 100px;
}
.ac_ks_inter {
background: rgba(0, 0, 0, 0.4);
height: 50px;
width: 50px;
line-height: 50px;
text-align: center;
border-radius: 50px;
color: white;
z-index: 999;
font-size: 12px;
overflow: hidden
}
.ac_ks_inter image {
width: 50px;
height: 50px;
}
.ac-poster-canvas {
position: absolute;
left: -100%;
}
.ac_ks_inter + .ac_ks_inter {
margin-top: 10px;
}
.ac-action {
margin: initial;
width: initial !important;
background: initial;
padding: initial;
font-weight: initial;
text-align: center;
font-size: 16px;
display: flex;
flex-direction: column;
align-items: center;
}
.ac-action image {
width: 64px;
height: 64px;
margin-bottom: 8px;
}
.ac-action text {
color: #fff;
}

View File

@ -0,0 +1,168 @@
module.exports =
/** *** */ (function (modules) { // webpackBootstrap
/** *** */ // The module cache
/** *** */ const 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)
/** *** */ const 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
/** *** */ const ns = Object.create(null)
/** *** */ __webpack_require__.r(ns)
/** *** */ Object.defineProperty(ns, 'default', {enumerable: true, value})
/** *** */ if (mode & 2 && typeof value !== 'string') for (const 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) {
/** *** */ const 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__) {
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() {
const buttons = this.data.buttons
const len = buttons.length
buttons.forEach((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
})
},
methods: {
buttonTap(e) {
const {
index
} = e.currentTarget.dataset
this.triggerEvent('buttontap', {
index,
item: this.data.buttons[index]
}, {})
},
close() {
const data = this.data
if (!data.maskClosable) return
this.setData({
show: false
})
this.triggerEvent('close', {}, {})
},
stopEvent() {}
}
})
/***/ })
/** *** */}))

View File

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

View File

@ -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}}" wx:key="index" 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>

View File

@ -0,0 +1 @@
.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 .2s 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 .2s ease-in}

View File

@ -0,0 +1,547 @@
module.exports =
/** *** */ (function (modules) { // webpackBootstrap
/** *** */ // The module cache
/** *** */ const 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)
/** *** */ const 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
/** *** */ const ns = Object.create(null)
/** *** */ __webpack_require__.r(ns)
/** *** */ Object.defineProperty(ns, 'default', {enumerable: true, value})
/** *** */ if (mode & 2 && typeof value !== 'string') for (const 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) {
/** *** */ const 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)
/** *** */ }([
/* 0 */
/***/ (function (module, exports, __webpack_require__) {
Object.defineProperty(exports, '__esModule', {value: true})
exports.default = [{
id: 0, cn: '[微笑]', hk: '[微笑]', us: '[Smile]', code: '/::)', web_code: '/微笑', style: 'smiley_0'
}, {
id: 1, cn: '[撇嘴]', hk: '[撇嘴]', us: '[Grimace]', code: '/::~', web_code: '/撇嘴', style: 'smiley_1'
}, {
id: 2, cn: '[色]', hk: '[色]', us: '[Drool]', code: '/::B', web_code: '/色', style: 'smiley_2'
}, {
id: 3, cn: '[发呆]', hk: '[發呆]', us: '[Scowl]', code: '/::|', web_code: '/发呆', style: 'smiley_3'
}, {
id: 4, cn: '[得意]', hk: '[得意]', us: '[CoolGuy]', code: '/:8-)', web_code: '/得意', style: 'smiley_4'
}, {
id: 5, cn: '[流泪]', hk: '[流淚]', us: '[Sob]', code: '/::<', web_code: '/流泪', style: 'smiley_5'
}, {
id: 6, cn: '[害羞]', hk: '[害羞]', us: '[Shy]', code: '/::$', web_code: '/害羞', style: 'smiley_6'
}, {
id: 7, cn: '[闭嘴]', hk: '[閉嘴]', us: '[Silent]', code: '/::X', web_code: '/闭嘴', style: 'smiley_7'
}, {
id: 8, cn: '[睡]', hk: '[睡]', us: '[Sleep]', code: '/::Z', web_code: '/睡', style: 'smiley_8'
}, {
id: 9, cn: '[大哭]', hk: '[大哭]', us: '[Cry]', code: '/::"(', web_code: '/大哭', style: 'smiley_9'
}, {
id: 10, cn: '[尴尬]', hk: '[尷尬]', us: '[Awkward]', code: '/::-|', web_code: '/尴尬', style: 'smiley_10'
}, {
id: 11, cn: '[发怒]', hk: '[發怒]', us: '[Angry]', code: '/::@', web_code: '/发怒', style: 'smiley_11'
}, {
id: 12, cn: '[调皮]', hk: '[調皮]', us: '[Tongue]', code: '/::P', web_code: '/调皮', style: 'smiley_12'
}, {
id: 13, cn: '[呲牙]', hk: '[呲牙]', us: '[Grin]', code: '/::D', web_code: '/呲牙', style: 'smiley_13'
}, {
id: 14, cn: '[惊讶]', hk: '[驚訝]', us: '[Surprise]', code: '/::O', web_code: '/惊讶', style: 'smiley_14'
}, {
id: 15, cn: '[难过]', hk: '[難過]', us: '[Frown]', code: '/::(', web_code: '/难过', style: 'smiley_15'
}, {
id: 16, cn: '[酷]', hk: '[酷]', us: '[Ruthless]', code: '/::+', web_code: '/酷', style: 'smiley_16'
}, {
id: 17, cn: '[冷汗]', hk: '[冷汗]', us: '[Blush]', code: '/:--b', web_code: '/冷汗', style: 'smiley_17'
}, {
id: 18, cn: '[抓狂]', hk: '[抓狂]', us: '[Scream]', code: '/::Q', web_code: '/抓狂', style: 'smiley_18'
}, {
id: 19, cn: '[吐]', hk: '[吐]', us: '[Puke]', code: '/::T', web_code: '/吐', style: 'smiley_19'
}, {
id: 20, cn: '[偷笑]', hk: '[偷笑]', us: '[Chuckle]', code: '/:,@P', web_code: '/偷笑', style: 'smiley_20'
}, {
id: 21, cn: '[愉快]', hk: '[愉快]', us: '[Joyful]', code: '/:,@-D', web_code: '/可爱', style: 'smiley_21'
}, {
id: 22, cn: '[白眼]', hk: '[白眼]', us: '[Slight]', code: '/::d', web_code: '/白眼', style: 'smiley_22'
}, {
id: 23, cn: '[傲慢]', hk: '[傲慢]', us: '[Smug]', code: '/:,@o', web_code: '/傲慢', style: 'smiley_23'
}, {
id: 24, cn: '[饥饿]', hk: '[饑餓]', us: '[Hungry]', code: '/::g', web_code: '/饥饿', style: 'smiley_24'
}, {
id: 25, cn: '[困]', hk: '[累]', us: '[Drowsy]', code: '/:|-)', web_code: '/困', style: 'smiley_25'
}, {
id: 26, cn: '[惊恐]', hk: '[驚恐]', us: '[Panic]', code: '/::!', web_code: '/惊恐', style: 'smiley_26'
}, {
id: 27, cn: '[流汗]', hk: '[流汗]', us: '[Sweat]', code: '/::L', web_code: '/流汗', style: 'smiley_27'
}, {
id: 28, cn: '[憨笑]', hk: '[大笑]', us: '[Laugh]', code: '/::>', web_code: '/憨笑', style: 'smiley_28'
}, {
id: 29, cn: '[悠闲]', hk: '[悠閑]', us: '[Commando]', code: '/::,@', web_code: '/大兵', style: 'smiley_29'
}, {
id: 30, cn: '[奋斗]', hk: '[奮鬥]', us: '[Determined]', code: '/:,@f', web_code: '/奋斗', style: 'smiley_30'
}, {
id: 31, cn: '[咒骂]', hk: '[咒罵]', us: '[Scold]', code: '/::-S', web_code: '/咒骂', style: 'smiley_31'
}, {
id: 32, cn: '[疑问]', hk: '[疑問]', us: '[Shocked]', code: '/:?', web_code: '/疑问', style: 'smiley_32'
}, {
id: 33, cn: '[嘘]', hk: '[噓]', us: '[Shhh]', code: '/:,@x', web_code: '/嘘', style: 'smiley_33'
}, {
id: 34, cn: '[晕]', hk: '[暈]', us: '[Dizzy]', code: '/:,@@', web_code: '/晕', style: 'smiley_34'
}, {
id: 35, cn: '[疯了]', hk: '[瘋了]', us: '[Tormented]', code: '/::8', web_code: '/折磨', style: 'smiley_35'
}, {
id: 36, cn: '[衰]', hk: '[衰]', us: '[Toasted]', code: '/:,@!', web_code: '/衰', style: 'smiley_36'
}, {
id: 37, cn: '[骷髅]', hk: '[骷髏頭]', us: '[Skull]', code: '/:!!!', web_code: '/骷髅', style: 'smiley_37'
}, {
id: 38, cn: '[敲打]', hk: '[敲打]', us: '[Hammer]', code: '/:xx', web_code: '/敲打', style: 'smiley_38'
}, {
id: 39, cn: '[再见]', hk: '[再見]', us: '[Wave]', code: '/:bye', web_code: '/再见', style: 'smiley_39'
}, {
id: 40, cn: '[擦汗]', hk: '[擦汗]', us: '[Speechless]', code: '/:wipe', web_code: '/擦汗', style: 'smiley_40'
}, {
id: 41, cn: '[抠鼻]', hk: '[摳鼻]', us: '[NosePick]', code: '/:dig', web_code: '/抠鼻', style: 'smiley_41'
}, {
id: 42, cn: '[鼓掌]', hk: '[鼓掌]', us: '[Clap]', code: '/:handclap', web_code: '/鼓掌', style: 'smiley_42'
}, {
id: 43, cn: '[糗大了]', hk: '[羞辱]', us: '[Shame]', code: '/:&-(', web_code: '/糗大了', style: 'smiley_43'
}, {
id: 44, cn: '[坏笑]', hk: '[壞笑]', us: '[Trick]', code: '/:B-)', web_code: '/坏笑', style: 'smiley_44'
}, {
id: 45, cn: '[左哼哼]', hk: '[左哼哼]', us: '[BahL]', code: '/:<@', web_code: '/左哼哼', style: 'smiley_45'
}, {
id: 46, cn: '[右哼哼]', hk: '[右哼哼]', us: '[BahR]', code: '/:@>', web_code: '/右哼哼', style: 'smiley_46'
}, {
id: 47, cn: '[哈欠]', hk: '[哈欠]', us: '[Yawn]', code: '/::-O', web_code: '/哈欠', style: 'smiley_47'
}, {
id: 48, cn: '[鄙视]', hk: '[鄙視]', us: '[Pooh-pooh]', code: '/:>-|', web_code: '/鄙视', style: 'smiley_48'
}, {
id: 49, cn: '[委屈]', hk: '[委屈]', us: '[Shrunken]', code: '/:P-(', web_code: '/委屈', style: 'smiley_49'
}, {
id: 50, cn: '[快哭了]', hk: '[快哭了]', us: '[TearingUp]', code: '/::"|', web_code: '/快哭了', style: 'smiley_50'
}, {
id: 51, cn: '[阴险]', hk: '[陰險]', us: '[Sly]', code: '/:X-)', web_code: '/阴险', style: 'smiley_51'
}, {
id: 52, cn: '[亲亲]', hk: '[親親]', us: '[Kiss]', code: '/::*', web_code: '/亲亲', style: 'smiley_52'
}, {
id: 53, cn: '[吓]', hk: '[嚇]', us: '[Wrath]', code: '/:@x', web_code: '/吓', style: 'smiley_53'
}, {
id: 54, cn: '[可怜]', hk: '[可憐]', us: '[Whimper]', code: '/:8*', web_code: '/可怜', style: 'smiley_54'
}, {
id: 55, cn: '[菜刀]', hk: '[菜刀]', us: '[Cleaver]', code: '/:pd', web_code: '/菜刀', style: 'smiley_55'
}, {
id: 56, cn: '[西瓜]', hk: '[西瓜]', us: '[Watermelon]', code: '/:<W>', web_code: '/西瓜', style: 'smiley_56'
}, {
id: 57, cn: '[啤酒]', hk: '[啤酒]', us: '[Beer]', code: '/:beer', web_code: '/啤酒', style: 'smiley_57'
}, {
id: 58, cn: '[篮球]', hk: '[籃球]', us: '[Basketball]', code: '/:basketb', web_code: '/篮球', style: 'smiley_58'
}, {
id: 59, cn: '[乒乓]', hk: '[乒乓]', us: '[PingPong]', code: '/:oo', web_code: '/乒乓', style: 'smiley_59'
}, {
id: 60, cn: '[咖啡]', hk: '[咖啡]', us: '[Coffee]', code: '/:coffee', web_code: '/咖啡', style: 'smiley_60'
}, {
id: 61, cn: '[饭]', hk: '[飯]', us: '[Rice]', code: '/:eat', web_code: '/饭', style: 'smiley_61'
}, {
id: 62, cn: '[猪头]', hk: '[豬頭]', us: '[Pig]', code: '/:pig', web_code: '/猪头', style: 'smiley_62'
}, {
id: 63, cn: '[玫瑰]', hk: '[玫瑰]', us: '[Rose]', code: '/:rose', web_code: '/玫瑰', style: 'smiley_63'
}, {
id: 64, cn: '[凋谢]', hk: '[枯萎]', us: '[Wilt]', code: '/:fade', web_code: '/凋谢', style: 'smiley_64'
}, {
id: 65, cn: '[嘴唇]', hk: '[嘴唇]', us: '[Lips]', code: '/:showlove', web_code: '/示爱', style: 'smiley_65'
}, {
id: 66, cn: '[爱心]', hk: '[愛心]', us: '[Heart]', code: '/:heart', web_code: '/爱心', style: 'smiley_66'
}, {
id: 67, cn: '[心碎]', hk: '[心碎]', us: '[BrokenHeart]', code: '/:break', web_code: '/心碎', style: 'smiley_67'
}, {
id: 68, cn: '[蛋糕]', hk: '[蛋糕]', us: '[Cake]', code: '/:cake', web_code: '/蛋糕', style: 'smiley_68'
}, {
id: 69, cn: '[闪电]', hk: '[閃電]', us: '[Lightning]', code: '/:li', web_code: '/闪电', style: 'smiley_69'
}, {
id: 70, cn: '[炸弹]', hk: '[炸彈]', us: '[Bomb]', code: '/:bome', web_code: '/炸弹', style: 'smiley_70'
}, {
id: 71, cn: '[刀]', hk: '[刀]', us: '[Dagger]', code: '/:kn', web_code: '/刀', style: 'smiley_71'
}, {
id: 72, cn: '[足球]', hk: '[足球]', us: '[Soccer]', code: '/:footb', web_code: '/足球', style: 'smiley_72'
}, {
id: 73, cn: '[瓢虫]', hk: '[甲蟲]', us: '[Ladybug]', code: '/:ladybug', web_code: '/瓢虫', style: 'smiley_73'
}, {
id: 74, cn: '[便便]', hk: '[便便]', us: '[Poop]', code: '/:shit', web_code: '/便便', style: 'smiley_74'
}, {
id: 75, cn: '[月亮]', hk: '[月亮]', us: '[Moon]', code: '/:moon', web_code: '/月亮', style: 'smiley_75'
}, {
id: 76, cn: '[太阳]', hk: '[太陽]', us: '[Sun]', code: '/:sun', web_code: '/太阳', style: 'smiley_76'
}, {
id: 77, cn: '[礼物]', hk: '[禮物]', us: '[Gift]', code: '/:gift', web_code: '/礼物', style: 'smiley_77'
}, {
id: 78, cn: '[拥抱]', hk: '[擁抱]', us: '[Hug]', code: '/:hug', web_code: '/拥抱', style: 'smiley_78'
}, {
id: 79, cn: '[强]', hk: '[強]', us: '[ThumbsUp]', code: '/:strong', web_code: '/强', style: 'smiley_79'
}, {
id: 80, cn: '[弱]', hk: '[弱]', us: '[ThumbsDown]', code: '/:weak', web_code: '/弱', style: 'smiley_80'
}, {
id: 81, cn: '[握手]', hk: '[握手]', us: '[Shake]', code: '/:share', web_code: '/握手', style: 'smiley_81'
}, {
id: 82, cn: '[胜利]', hk: '[勝利]', us: '[Peace]', code: '/:v', web_code: '/胜利', style: 'smiley_82'
}, {
id: 83, cn: '[抱拳]', hk: '[抱拳]', us: '[Fight]', code: '/:@)', web_code: '/抱拳', style: 'smiley_83'
}, {
id: 84, cn: '[勾引]', hk: '[勾引]', us: '[Beckon]', code: '/:jj', web_code: '/勾引', style: 'smiley_84'
}, {
id: 85, cn: '[拳头]', hk: '[拳頭]', us: '[Fist]', code: '/:@@', web_code: '/拳头', style: 'smiley_85'
}, {
id: 86, cn: '[差劲]', hk: '[差勁]', us: '[Pinky]', code: '/:bad', web_code: '/差劲', style: 'smiley_86'
}, {
id: 87, cn: '[爱你]', hk: '[愛你]', us: '[RockOn]', code: '/:lvu', web_code: '/爱你', style: 'smiley_87'
}, {
id: 88, cn: '[NO]', hk: '[NO]', us: '[Nuh-uh]', code: '/:no', web_code: '/NO', style: 'smiley_88'
}, {
id: 89, cn: '[OK]', hk: '[OK]', us: '[OK]', code: '/:ok', web_code: '/OK', style: 'smiley_89'
}, {
id: 90, cn: '[爱情]', hk: '[愛情]', us: '[InLove]', code: '/:love', web_code: '/爱情', style: 'smiley_90'
}, {
id: 91, cn: '[飞吻]', hk: '[飛吻]', us: '[Blowkiss]', code: '/:<L>', web_code: '/飞吻', style: 'smiley_91'
}, {
id: 92, cn: '[跳跳]', hk: '[跳跳]', us: '[Waddle]', code: '/:jump', web_code: '/跳跳', style: 'smiley_92'
}, {
id: 93, cn: '[发抖]', hk: '[發抖]', us: '[Tremble]', code: '/:shake', web_code: '/发抖', style: 'smiley_93'
}, {
id: 94, cn: '[怄火]', hk: '[噴火]', us: '[Aaagh!]', code: '/:<O>', web_code: '/怄火', style: 'smiley_94'
}, {
id: 95, cn: '[转圈]', hk: '[轉圈]', us: '[Twirl]', code: '/:circle', web_code: '/转圈', style: 'smiley_95'
}, {
id: 96, cn: '[磕头]', hk: '[磕頭]', us: '[Kotow]', code: '/:kotow', web_code: '/磕头', style: 'smiley_96'
}, {
id: 97, cn: '[回头]', hk: '[回頭]', us: '[Dramatic]', code: '/:turn', web_code: '/回头', style: 'smiley_97'
}, {
id: 98, cn: '[跳绳]', hk: '[跳繩]', us: '[JumpRope]', code: '/:skip', web_code: '/跳绳', style: 'smiley_98'
}, {
id: 99, cn: '[投降]', hk: '[投降]', us: '[Surrender]', code: '/:oY', web_code: '/挥手', style: 'smiley_99'
}, {
id: 100, cn: '[激动]', hk: '[激動]', us: '[Hooray]', code: '/:#-0', web_code: '/激动', style: 'smiley_100'
}, {
id: 101, cn: '[乱舞]', hk: '[亂舞]', us: '[Meditate]', code: '/:hiphot', web_code: '/街舞', style: 'smiley_101'
}, {
id: 102, cn: '[献吻]', hk: '[獻吻]', us: '[Smooch]', code: '/:kiss', web_code: '/献吻', style: 'smiley_102'
}, {
id: 103, cn: '[左太极]', hk: '[左太極]', us: '[TaiChi L]', code: '/:<&', web_code: '/左太极', style: 'smiley_103'
}, {
id: 104, cn: '[右太极]', hk: '[右太極]', us: '[TaiChi R]', code: '/:&>', web_code: '/右太极', style: 'smiley_104'
}, {
id: 204, cn: '[嘿哈]', hk: '[吼嘿]', us: '[Hey]', code: '', web_code: '', style: 'e2_04'
}, {
id: 205, cn: '[捂脸]', hk: '[掩面]', us: '[Facepalm]', code: '', web_code: '', style: 'e2_05'
}, {
id: 202, cn: '[奸笑]', hk: '[奸笑]', us: '[Smirk]', code: '', web_code: '', style: 'e2_02'
}, {
id: 206, cn: '[机智]', hk: '[機智]', us: '[Smart]', code: '', web_code: '', style: 'e2_06'
}, {
id: 212, cn: '[皱眉]', hk: '[皺眉]', us: '[Moue]', code: '', web_code: '', style: 'e2_12'
}, {
id: 211, cn: '[耶]', hk: '[歐耶]', us: '[Yeah!]', code: '', web_code: '', style: 'e2_11'
}, {
id: 207, cn: '[茶]', hk: '[茶]', us: '[Tea]', code: '', web_code: '', style: 'e2_07'
}, {
id: 209, cn: '[红包]', hk: '[Packet]', us: '[Packet]', code: '', web_code: '', style: 'e2_09'
}, {
id: 210, cn: '[蜡烛]', hk: '[蠟燭]', us: '[Candle]', code: '', web_code: '', style: 'e2_10'
}, {
id: 215, cn: '[福]', hk: '[福]', us: '[Blessing]', code: '', web_code: '', style: 'e2_15'
}, {
id: 214, cn: '[鸡]', hk: '[小雞]', us: '[Chick]', code: '', web_code: '', style: 'e2_14'
}, {
id: 300, cn: '[笑脸]', emoji: '😄', hk: '', us: '', code: '\\ue415', web_code: '', style: 'u1F604'
}, {
id: 301, cn: '[生病]', emoji: '😷', hk: '', us: '', code: '\\ue40c', web_code: '', style: 'u1F637'
}, {
id: 302, cn: '[破涕为笑]', emoji: '😂', hk: '', us: '', code: '\\ue412', web_code: '', style: 'u1F602'
}, {
id: 303, cn: '[吐舌]', emoji: '😝', hk: '', us: '', code: '\\ue409', web_code: '', style: 'u1F61D'
}, {
id: 304, cn: '[脸红]', emoji: '😳', hk: '', us: '', code: '\\ue40d', web_code: '', style: 'u1F633'
}, {
id: 305, cn: '[恐惧]', emoji: '😱', hk: '', us: '', code: '\\ue107', web_code: '', style: 'u1F631'
}, {
id: 306, cn: '[失望]', emoji: '😔', hk: '', us: '', code: '\\ue403', web_code: '', style: 'u1F614'
}, {
id: 307, cn: '[无语]', emoji: '😒', hk: '', us: '', code: '\\ue40e', web_code: '', style: 'u1F612'
}, {
id: 308, cn: '[鬼魂]', emoji: '👻', hk: '', us: '', code: '\\ue11b', web_code: '', style: 'u1F47B'
}, {
id: 309, cn: '[合十]', emoji: '🙏', hk: '', us: '', code: '\\ue41d', web_code: '', style: 'u1F64F'
}, {
id: 310, cn: '[强壮]', emoji: '💪', hk: '', us: '', code: '\\ue14c', web_code: '', style: 'u1F4AA'
}, {
id: 311, cn: '[庆祝]', emoji: '🎉', hk: '', us: '', code: '\\ue312', web_code: '', style: 'u1F389'
}, {
id: 312, cn: '[礼物]', hk: '', us: '', code: '\\ue112', web_code: '', style: 'u1F381'
}, {
id: 313, cn: '[吃瓜]', hk: '[]', us: '[]', code: '', web_code: '', style: 'smiley_313'
}, {
id: 314, cn: '[加油]', hk: '[]', us: '[]', code: '', web_code: '', style: 'smiley_314'
}, {
id: 315, cn: '[汗]', hk: '[]', us: '[]', code: '', web_code: '', style: 'smiley_315'
}, {
id: 316, cn: '[天啊]', hk: '[]', us: '[]', code: '', web_code: '', style: 'smiley_316'
}, {
id: 317, cn: '[Emm]', hk: '[]', us: '[]', code: '', web_code: '', style: 'smiley_317'
}, {
id: 318, cn: '[社会社会]', hk: '[]', us: '[]', code: '', web_code: '', style: 'smiley_318'
}, {
id: 319, cn: '[旺柴]', hk: '[]', us: '[]', code: '', web_code: '', style: 'smiley_319'
}, {
id: 320, cn: '[好的]', hk: '[]', us: '[]', code: '', web_code: '', style: 'smiley_320'
}, {
id: 321, cn: '[打脸]', hk: '[]', us: '[]', code: '', web_code: '', style: 'smiley_321'
}, {
id: 322, cn: '[哇]', hk: '[]', us: '[]', code: '', web_code: '', style: 'smiley_322'
}]
/***/ }),
/* 1 */,
/* 2 */
/***/ (function (module, exports, __webpack_require__) {
Object.defineProperty(exports, '__esModule', {value: true})
const emoji_data_1 = __webpack_require__(0)
const emoji_panel_data_1 = __webpack_require__(3)
const parser_1 = __webpack_require__(4)
const EMOTION_SIZE = 40
const emotionMap = {}
const emotionNames = []
emoji_data_1.default.forEach(function (item) {
emotionMap[item.id] = item
emotionNames.push(item.cn)
})
const emotions = []
emoji_panel_data_1.default.forEach(function (id) {
return emotions.push(emotionMap[id])
})
Component({
options: {
styleIsolation: 'page-shared',
addGlobalClass: true,
pureDataPattern: /^_/
},
properties: {
padding: {
type: Number,
value: 15
},
backgroundColor: {
type: String,
value: '#EDEDED'
},
showSend: {
type: Boolean,
value: true
},
showDel: {
type: Boolean,
value: true
},
showHistory: {
type: Boolean,
value: true
},
height: {
type: Number,
value: 300
},
source: {
type: String,
value: ''
},
// 适配 darkmode
theme: {
type: String,
value: 'light' // light dark
}
},
data: {
history: [],
emotions,
extraPadding: 0,
perLine: 0
},
lifetimes: {
attached: function attached() {
const padding = this.data.padding
const systemInfo = wx.getSystemInfoSync()
const areaWidth = systemInfo.windowWidth
const perLine = Math.floor((areaWidth - padding * 2) / 45)
const extraPadding = Math.floor((areaWidth - padding * 2 - perLine * EMOTION_SIZE) / (perLine - 1))
this.setData({
perLine,
extraPadding,
hasSafeBottom: systemInfo.model.indexOf('iPhone X') >= 0
})
}
},
methods: {
getEmojiNames() {
return emotionNames
},
parseEmoji: parser_1.parseEmoji,
insertEmoji(evt) {
const data = this.data
const idx = evt.currentTarget.dataset.idx
const emotionName = data.emotions[idx].cn
this.LRUCache(data.history, data.perLine, idx)
this.setData({history: data.history})
this.triggerEvent('insertemoji', {emotionName})
},
deleteEmoji() {
this.triggerEvent('delemoji')
},
send() {
this.triggerEvent('send')
},
LRUCache(arr, limit, data) {
const idx = arr.indexOf(data)
if (idx >= 0) {
arr.splice(idx, 1)
arr.unshift(data)
} else if (arr.length < limit) {
arr.push(data)
} else if (arr.length === limit) {
arr[limit - 1] = data
}
}
}
})
/***/ }),
/* 3 */
/***/ (function (module, exports, __webpack_require__) {
Object.defineProperty(exports, '__esModule', {value: true})
exports.default = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 17, 18, 19, 20, 21, 22, 23, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 36, 37, 38, 39, 40, 41, 42, 44, 45, 46, 47, 48, 49, 50, 51, 52, 54, 55, 56, 57, 60, 62, 63, 64, 65, 66, 67, 68, 70, 74, 75, 76, 78, 79, 80, 81, 82, 83, 84, 85, 89, 92, 93, 94, 95, 300, 301, 302, 303, 304, 305, 306, 307, 204, 205, 202, 206, 212, 211, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 308, 309, 310, 311, 312, 209]
/***/ }),
/* 4 */
/***/ (function (module, exports, __webpack_require__) {
Object.defineProperty(exports, '__esModule', {value: true})
const emoji_data_1 = __webpack_require__(0)
const emotionMap = {}
emoji_data_1.default.forEach(function (item, index) {
if (item.cn) {
emotionMap[item.cn] = item
}
if (item.code) emotionMap[item.code] = item
if (item.us) emotionMap[item.us] = item
})
const parseEmoji = function parseEmoji(content) {
let emojiIndexList = []
for (const k in emotionMap) {
let idx = content.indexOf(k)
while (idx >= 0) {
emojiIndexList.push({idx, code: k, type: 2})
idx = content.indexOf(k, idx + k.length)
}
}
emojiIndexList = emojiIndexList.sort(function (a, b) {
return a.idx - b.idx
})
const newContentList = []
let lastTextIndex = 0
emojiIndexList.forEach(function (item) {
if (lastTextIndex !== item.idx) {
newContentList.push({
type: 1,
content: content.substring(lastTextIndex, item.idx)
})
}
if (item.type === 2) {
newContentList.push({
type: item.type,
content: content.substr(item.idx, item.code.length),
imageClass: emotionMap[item.code].style
})
} else {
newContentList.push({
type: item.type,
content: item.code,
imageClass: item.value
})
}
lastTextIndex = item.idx + item.code.length
})
const lastText = content.substring(lastTextIndex)
if (lastText) {
newContentList.push({
type: 1,
content: lastText
})
}
return newContentList
}
exports.parseEmoji = parseEmoji
/***/ })
/** *** */ ]))

View File

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

View File

@ -0,0 +1,30 @@
<!--components/emoji/emoji.wxml-->
<view class="weui-emoji_area" style="height: {{height}}px; background-color: {{backgroundColor}}">
<view
class="weui-emotion_list"
style="padding-left: {{padding}}px; padding-right: {{padding}}px;"
>
<view hidden="{{!showHistory || history.length === 0}}">
<view class="weui-emotion_head">最近使用</view>
<block wx:for="{{history}}" wx:key="*this">
<view class="weui-emotion_item" data-idx="{{item}}" bindtap="insertEmoji" style="margin-right: {{(index + 1) % perLine ? extraPadding : 0}}px">
<view class="weui-icon_emotion {{emotions[item].style}}" style="background-image: url({{source}});"></view>
</view>
</block>
</view>
<!-- 图片32px每个宽度40px -->
<view class="weui-emotion_head" style="margin-top: 8px;">所有表情{{emotions.length}}</view>
<block wx:for="{{emotions}}" wx:key="*this">
<view class="weui-emotion_item" data-idx="{{index}}" bindtap="insertEmoji" style="padding-right: {{(index + 1) % perLine ? extraPadding : 0}}px">
<view class="weui-icon_emotion {{item.style}}" style="background-image: url({{source}});"></view>
</view>
</block>
</view>
<!--操作-->
<view class="weui-emoji__operation">
<view class="weui-emoji__operation__delete" bindtap="deleteEmoji" wx:if="{{showDel}}">
<image src="./icon_emotion_del.png" class="weui-emotion_del_btn"></image>
</view>
<view class="weui-emoji__operation__send" bindtap="send" wx:if="{{showSend}}">发送</view>
</view>
</view>

View File

@ -0,0 +1,870 @@
/*!-----The css code below is created by----*/
.e2_02,
.e2_04,
.e2_05,
.e2_06,
.e2_09,
.e2_11,
.e2_12,
.e2_14,
.smiley_0,
.smiley_1,
.smiley_10,
.smiley_11,
.smiley_12,
.smiley_13,
.smiley_14,
.smiley_15,
.smiley_17,
.smiley_18,
.smiley_19,
.smiley_2,
.smiley_20,
.smiley_21,
.smiley_22,
.smiley_23,
.smiley_25,
.smiley_26,
.smiley_27,
.smiley_28,
.smiley_29,
.smiley_3,
.smiley_30,
.smiley_31,
.smiley_313,
.smiley_314,
.smiley_315,
.smiley_316,
.smiley_317,
.smiley_318,
.smiley_319,
.smiley_32,
.smiley_320,
.smiley_321,
.smiley_322,
.smiley_33,
.smiley_34,
.smiley_36,
.smiley_37,
.smiley_38,
.smiley_39,
.smiley_4,
.smiley_40,
.smiley_41,
.smiley_42,
.smiley_44,
.smiley_45,
.smiley_46,
.smiley_47,
.smiley_48,
.smiley_49,
.smiley_5,
.smiley_50,
.smiley_51,
.smiley_52,
.smiley_54,
.smiley_55,
.smiley_56,
.smiley_57,
.smiley_6,
.smiley_60,
.smiley_61,
.smiley_62,
.smiley_63,
.smiley_64,
.smiley_65,
.smiley_66,
.smiley_67,
.smiley_68,
.smiley_7,
.smiley_70,
.smiley_74,
.smiley_75,
.smiley_76,
.smiley_78,
.smiley_79,
.smiley_8,
.smiley_80,
.smiley_81,
.smiley_82,
.smiley_83,
.smiley_84,
.smiley_85,
.smiley_89,
.smiley_9,
.smiley_92,
.smiley_93,
.smiley_94,
.smiley_95,
.u1F381,
.u1F389,
.u1F47B,
.u1F4AA,
.u1F602,
.u1F604,
.u1F612,
.u1F614,
.u1F61D,
.u1F631,
.u1F633,
.u1F637,
.u1F64F {
display: inline-block;
background-repeat: no-repeat
}
.e2_02 {
width: 64px;
height: 64px;
background-position: -66px 0
}
.e2_04 {
width: 64px;
height: 64px;
background-position: -462px -396px
}
.e2_05 {
width: 64px;
height: 64px;
background-position: 0 -66px
}
.e2_06 {
width: 64px;
height: 64px;
background-position: -66px -66px
}
.e2_09 {
width: 64px;
height: 64px;
background-position: -132px 0
}
.e2_11 {
width: 64px;
height: 64px;
background-position: -132px -66px
}
.e2_12 {
width: 64px;
height: 64px;
background-position: 0 -132px
}
.e2_14 {
width: 64px;
height: 64px;
background-position: -66px -132px
}
.smiley_0 {
width: 64px;
height: 64px;
background-position: -132px -132px
}
.smiley_1 {
width: 63px;
height: 64px;
background-position: -660px -594px
}
.smiley_10 {
width: 64px;
height: 64px;
background-position: -198px -66px
}
.smiley_11 {
width: 64px;
height: 64px;
background-position: -198px -132px
}
.smiley_12 {
width: 64px;
height: 64px;
background-position: 0 -198px
}
.smiley_13 {
width: 64px;
height: 64px;
background-position: -66px -198px
}
.smiley_14 {
width: 64px;
height: 64px;
background-position: -132px -198px
}
.smiley_15 {
width: 64px;
height: 64px;
background-position: -198px -198px
}
.smiley_17 {
width: 64px;
height: 64px;
background-position: -264px 0
}
.smiley_18 {
width: 64px;
height: 64px;
background-position: -264px -66px
}
.smiley_19 {
width: 64px;
height: 64px;
background-position: -264px -132px
}
.smiley_2 {
width: 64px;
height: 64px;
background-position: -264px -198px
}
.smiley_20 {
width: 64px;
height: 64px;
background-position: 0 -264px
}
.smiley_21 {
width: 64px;
height: 64px;
background-position: -66px -264px
}
.smiley_22 {
width: 64px;
height: 64px;
background-position: -132px -264px
}
.smiley_23 {
width: 64px;
height: 64px;
background-position: -198px -264px
}
.smiley_25 {
width: 64px;
height: 64px;
background-position: -264px -264px
}
.smiley_26 {
width: 64px;
height: 64px;
background-position: -330px 0
}
.smiley_27 {
width: 64px;
height: 64px;
background-position: -330px -66px
}
.smiley_28 {
width: 64px;
height: 64px;
background-position: -330px -132px
}
.smiley_29 {
width: 64px;
height: 64px;
background-position: -330px -198px
}
.smiley_3 {
width: 64px;
height: 64px;
background-position: -330px -264px
}
.smiley_30 {
width: 64px;
height: 64px;
background-position: 0 -330px
}
.smiley_31 {
width: 64px;
height: 64px;
background-position: -66px -330px
}
.smiley_313 {
width: 64px;
height: 64px;
background-position: -132px -330px
}
.smiley_314 {
width: 64px;
height: 64px;
background-position: -198px -330px
}
.smiley_315 {
width: 64px;
height: 64px;
background-position: -264px -330px
}
.smiley_316 {
width: 64px;
height: 64px;
background-position: -330px -330px
}
.smiley_317 {
width: 64px;
height: 64px;
background-position: -396px 0
}
.smiley_318 {
width: 64px;
height: 64px;
background-position: -396px -66px
}
.smiley_319 {
width: 64px;
height: 64px;
background-position: -396px -132px
}
.smiley_32 {
width: 64px;
height: 64px;
background-position: -396px -198px
}
.smiley_320 {
width: 64px;
height: 64px;
background-position: -396px -264px
}
.smiley_321 {
width: 64px;
height: 64px;
background-position: -396px -330px
}
.smiley_322 {
width: 64px;
height: 64px;
background-position: 0 -396px
}
.smiley_33 {
width: 64px;
height: 64px;
background-position: -66px -396px
}
.smiley_34 {
width: 64px;
height: 64px;
background-position: -132px -396px
}
.smiley_36 {
width: 64px;
height: 64px;
background-position: -198px -396px
}
.smiley_37 {
width: 64px;
height: 64px;
background-position: -264px -396px
}
.smiley_38 {
width: 64px;
height: 64px;
background-position: -330px -396px
}
.smiley_39 {
width: 64px;
height: 64px;
background-position: -396px -396px
}
.smiley_4 {
width: 64px;
height: 64px;
background-position: -462px 0
}
.smiley_40 {
width: 64px;
height: 64px;
background-position: -462px -66px
}
.smiley_41 {
width: 64px;
height: 64px;
background-position: -462px -132px
}
.smiley_42 {
width: 64px;
height: 64px;
background-position: -462px -198px
}
.smiley_44 {
width: 64px;
height: 64px;
background-position: -462px -264px
}
.smiley_45 {
width: 64px;
height: 64px;
background-position: -462px -330px
}
.smiley_46 {
width: 64px;
height: 64px;
background-position: 0 0
}
.smiley_47 {
width: 64px;
height: 64px;
background-position: 0 -462px
}
.smiley_48 {
width: 64px;
height: 64px;
background-position: -66px -462px
}
.smiley_49 {
width: 64px;
height: 64px;
background-position: -132px -462px
}
.smiley_5 {
width: 64px;
height: 64px;
background-position: -198px -462px
}
.smiley_50 {
width: 64px;
height: 64px;
background-position: -264px -462px
}
.smiley_51 {
width: 64px;
height: 64px;
background-position: -330px -462px
}
.smiley_52 {
width: 64px;
height: 64px;
background-position: -396px -462px
}
.smiley_54 {
width: 64px;
height: 64px;
background-position: -462px -462px
}
.smiley_55 {
width: 64px;
height: 64px;
background-position: -528px 0
}
.smiley_56 {
width: 64px;
height: 64px;
background-position: -528px -66px
}
.smiley_57 {
width: 64px;
height: 64px;
background-position: -528px -132px
}
.smiley_6 {
width: 64px;
height: 64px;
background-position: -528px -198px
}
.smiley_60 {
width: 64px;
height: 64px;
background-position: -528px -264px
}
.smiley_61 {
width: 64px;
height: 64px;
background-position: -528px -330px
}
.smiley_62 {
width: 64px;
height: 64px;
background-position: -528px -396px
}
.smiley_63 {
width: 64px;
height: 64px;
background-position: -528px -462px
}
.smiley_64 {
width: 64px;
height: 64px;
background-position: 0 -528px
}
.smiley_65 {
width: 64px;
height: 64px;
background-position: -66px -528px
}
.smiley_66 {
width: 64px;
height: 64px;
background-position: -132px -528px
}
.smiley_67 {
width: 64px;
height: 64px;
background-position: -198px -528px
}
.smiley_68 {
width: 64px;
height: 64px;
background-position: -264px -528px
}
.smiley_7 {
width: 64px;
height: 64px;
background-position: -330px -528px
}
.smiley_70 {
width: 64px;
height: 64px;
background-position: -396px -528px
}
.smiley_74 {
width: 64px;
height: 64px;
background-position: -462px -528px
}
.smiley_75 {
width: 64px;
height: 64px;
background-position: -528px -528px
}
.smiley_76 {
width: 64px;
height: 64px;
background-position: -594px 0
}
.smiley_78 {
width: 64px;
height: 64px;
background-position: -594px -66px
}
.smiley_79 {
width: 64px;
height: 64px;
background-position: -594px -132px
}
.smiley_8 {
width: 64px;
height: 64px;
background-position: -594px -198px
}
.smiley_80 {
width: 64px;
height: 64px;
background-position: -594px -264px
}
.smiley_81 {
width: 64px;
height: 64px;
background-position: -594px -330px
}
.smiley_82 {
width: 64px;
height: 64px;
background-position: -594px -396px
}
.smiley_83 {
width: 64px;
height: 64px;
background-position: -594px -462px
}
.smiley_84 {
width: 64px;
height: 64px;
background-position: -594px -528px
}
.smiley_85 {
width: 64px;
height: 64px;
background-position: 0 -594px
}
.smiley_89 {
width: 64px;
height: 64px;
background-position: -66px -594px
}
.smiley_9 {
width: 64px;
height: 64px;
background-position: -132px -594px
}
.smiley_92 {
width: 64px;
height: 64px;
background-position: -198px -594px
}
.smiley_93 {
width: 64px;
height: 64px;
background-position: -264px -594px
}
.smiley_94 {
width: 64px;
height: 64px;
background-position: -330px -594px
}
.smiley_95 {
width: 64px;
height: 64px;
background-position: -396px -594px
}
.u1F381 {
width: 64px;
height: 64px;
background-position: -462px -594px
}
.u1F389 {
width: 64px;
height: 64px;
background-position: -528px -594px
}
.u1F47B {
width: 64px;
height: 64px;
background-position: -594px -594px
}
.u1F4AA {
width: 64px;
height: 64px;
background-position: -660px 0
}
.u1F602 {
width: 64px;
height: 64px;
background-position: -660px -66px
}
.u1F604 {
width: 64px;
height: 64px;
background-position: -660px -132px
}
.u1F612 {
width: 64px;
height: 64px;
background-position: -660px -198px
}
.u1F614 {
width: 64px;
height: 64px;
background-position: -660px -264px
}
.u1F61D {
width: 64px;
height: 64px;
background-position: -660px -330px
}
.u1F631 {
width: 64px;
height: 64px;
background-position: -660px -396px
}
.u1F633 {
width: 64px;
height: 64px;
background-position: -660px -462px
}
.u1F637 {
width: 64px;
height: 64px;
background-position: -198px 0
}
.u1F64F {
width: 64px;
height: 64px;
background-position: -660px -528px
}
.weui-emotion_list {
padding: 0 10px;
overflow-y: auto;
-webkit-overflow-scrolling: touch;
width: 100%;
height: 100%;
-webkit-box-sizing: border-box;
box-sizing: border-box;
white-space: normal;
font-size: 0;
padding-bottom: constant(safe-area-inset-bottom);
padding-bottom: env(safe-area-inset-bottom);
}
.weui-emotion_item {
display: inline-block;
position: relative;
width: 40px;
height: 40px;
padding-bottom: 5px;
line-height: 40px
}
.weui-icon_emotion {
position: absolute;
top: 4px;
left: 4px;
display: inline-block;
transform-origin: 0 0;
transform: scale(.5)
}
.weui-emotion_head {
margin: 14px 5px 8px;
color: var(--weui-FG-0);
font-size: 14px;
text-align: left
}
.weui-emoji_area {
position: relative;
width: 100%;
background: var(--weui-BG-0)
}
.weui-emoji_area__has-safe-bottom {
padding-bottom: 34px
}
.weui-emotion_del_btn {
display: inline-block;
width: 24px;
height: 24px;
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%)
}
.weui-emoji__operation {
position: absolute;
bottom: 34px;
right: 12px;
width: 120px;
height: 44px;
display: flex;
align-items: center;
justify-content: flex-end
}
.weui-emoji__operation__delete,
.weui-emoji__operation__send {
display: inline-block;
width: 56px;
height: 44px;
line-height: 44px;
text-align: center;
border-radius: 4px;
font-size: 16px
}
.weui-emoji__operation__delete {
position: relative;
font-size: 0;
background-color: var(--weui-BG-3)
}
.weui-emoji__operation__send {
margin-left: 8px;
background-color: #04C160;
color: rgba(255, 255, 255, 0.9)
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 869 B

View File

@ -0,0 +1,125 @@
module.exports =
/** *** */ (function (modules) { // webpackBootstrap
/** *** */ // The module cache
/** *** */ const 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)
/** *** */ const 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
/** *** */ const ns = Object.create(null)
/** *** */ __webpack_require__.r(ns)
/** *** */ Object.defineProperty(ns, 'default', {enumerable: true, value})
/** *** */ if (mode & 2 && typeof value !== 'string') for (const 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) {
/** *** */ const 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__) {
Component({
options: {
addGlobalClass: true,
multipleSlots: true
},
properties: {
title: {
type: String,
value: ''
},
subtitle: {
type: String,
value: ''
}
},
relations: {
'../cells/cells': {
type: 'descendant',
linked(target) {
if (!this.data.firstItem) {
this.data.firstItem = target
}
target.setOuterClass('weui-cells__group weui-cells__group_form weui-cells_form')
if (target !== this.data.firstItem) {
target.setOuterClass('weui-cells__group_wxss weui-cells__group weui-cells__group_form weui-cells_form')
}
}
}
},
data: {
firstItem: null
}
})
/***/ })
/** *** */}))

View File

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

View File

@ -0,0 +1,31 @@
<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">
<slot></slot>
</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>

View File

@ -0,0 +1,564 @@
module.exports =
/** *** */ (function (modules) { // webpackBootstrap
/** *** */ // The module cache
/** *** */ const 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)
/** *** */ const 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
/** *** */ const ns = Object.create(null)
/** *** */ __webpack_require__.r(ns)
/** *** */ Object.defineProperty(ns, 'default', {enumerable: true, value})
/** *** */ if (mode & 2 && typeof value !== 'string') for (const 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) {
/** *** */ const 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__) {
Object.defineProperty(exports, '__esModule', {value: true})
exports.diff = function (old, newVal) {
if (!old && newVal || old && !newVal) return true
for (const k in newVal) {
if (old[k] !== newVal[k]) return true
}
for (const _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
const diffObj = {}
let isDiff = false
for (const k in newVal) {
if (old[k] !== newVal[k]) {
isDiff = true
diffObj[k] = newVal[k]
}
}
for (const _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__) {
Object.defineProperty(exports, '__esModule', {value: true})
const form_validator_1 = __webpack_require__(5)
const 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,
unlinked
},
'../checkbox-group/checkbox-group': {
type: 'descendant',
linked,
unlinked
}
},
attached: function attached() {
this.initRules()
this.formValidator = new form_validator_1.default(this.data.models, this.data.newRules)
},
methods: {
initRules: function initRules(rules) {
const newRules = {};
(rules || this.data.rules).forEach(function (rule) {
if (rule.name && rule.rules) {
newRules[rule.name] = rule.rules || []
}
})
this.setData({newRules})
return newRules
},
_modelChange: function _modelChange(newVal, oldVal, path) {
const _this = this
if (!this.isInit) {
this.isInit = true
return newVal
}
this.formValidator.setModel(newVal)
this.isInit = true
const diffObj = object_1.diffObject(oldVal, newVal)
if (diffObj) {
(function () {
let isValid = true
const errors = []
const errorMap = {}
const _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 (const k in diffObj) {
_loop(k)
}
_this._showErrors(diffObj, errorMap)
_this.triggerEvent(isValid ? 'success' : 'fail', isValid ? {trigger: 'change'} : {errors, trigger: 'change'})
}())
}
return newVal
},
_rulesChange: function _rulesChange(newVal) {
const newRules = this.initRules(newVal)
if (this.formValidator) {
this.formValidator.setRules(newRules)
}
return newVal
},
_showAllErrors: function _showAllErrors(errors) {
for (const k in this.data.newRules) {
this._showError(k, errors && errors[k])
}
},
_showErrors: function _showErrors(objs, errors) {
for (const k in objs) {
this._showError(k, errors && errors[k])
}
},
_showError: function _showError(prop, error) {
const formItem = this.data.formItems[prop]
if (formItem && formItem.data.showError) {
formItem.setError(error)
}
},
validate: function validate(cb) {
const _this2 = this
return this.formValidator.validate(function (isValid, errors) {
_this2._showAllErrors(errors)
const 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) {
const _this3 = this
const cb = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function (v) {
const error = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null
}
return this.formValidator.validateField(name, value, function (isValid, errors) {
_this3._showError(name, errors)
const 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) {
const 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__) {
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function') } }
Object.defineProperty(exports, '__esModule', {value: true})
const validator_1 = __webpack_require__(6)
const object_1 = __webpack_require__(0)
const toString = Object.prototype.toString
const validateSingleRule = function validateSingleRule(rule, value) {
const param = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null
const models = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null
let message = ''
for (const ruleKey in rule) {
if (ruleKey === 'name' || ruleKey === 'message') continue
const 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
}
const FormValidator = (function () {
function FormValidator(models, rules) {
_classCallCheck(this, FormValidator)
this.models = models
this.rules = rules
this.errors = {}
}
FormValidator.prototype.validate = function validate(cb) {
const _this = this
return new Promise(function (resolve) {
let fieldCount = 0
let failCount = 0
const errors = _this.errors
const models = _this.models
let errorChanged = false
const _loop = function _loop(k) {
(function (fieldName) {
const 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 (const k in _this.rules) {
_loop(k)
}
if (errorChanged) {}
const 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) {
const _this2 = this
const cb = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function (v) {
const error = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null
}
return new Promise(function (resolve) {
_this2._innerValidateField(name, value, function (valid, error) {
const errObj = {}
errObj[name] = error
resolve({valid, error: valid ? undefined : error})
cb(valid, valid ? undefined : errObj)
const oldError = _this2.errors[name]
const 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) {
let cb = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function (v) {
const errors = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null
}
const 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
}
let isFail = false
const models = this.models
if (toString.call(rules) === '[object Array]') {
rules.forEach(function (rule) {
rule.name = name
const resMessage = validateSingleRule(rule, value || models[name], rule.param, models)
if (resMessage && !isFail) {
isFail = true
const error = resMessage ? {message: resMessage, rule} : undefined
cb(false, error)
}
})
if (!isFail) {
cb(!isFail)
}
} else {
const rule = rules
rule.name = name
const resMessage = validateSingleRule(rule, value || models[name], rule.param, models)
const error = resMessage ? {message: resMessage, 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__) {
Object.defineProperty(exports, '__esModule', {value: true})
const string_1 = __webpack_require__(7)
const 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) {
const minlen = r.minlength
val = val || ''
if (val.length < minlen) return string_1.sprintf(r.message || defaultMessage.minlength, minlen)
},
maxlength: function maxlength(r, val) {
const maxlen = r.maxlength
val = val || ''
if (val.length > maxlen) return string_1.sprintf(r.message || defaultMessage.maxlength, maxlen)
},
rangelength: function rangelength(r, val) {
const 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) {
const min = r.min
if (val < min) return string_1.sprintf(r.message || defaultMessage.min, min)
},
max: function max(r, val) {
const max = r.max
if (val > max) return string_1.sprintf(r.message || defaultMessage.max, max)
},
range: function range(r, val) {
const 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) {
const 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
const 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__) {
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]
}
let i = void 0
let result = args[0] || ''
let para = void 0
let reg = void 0
const 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
}
/***/ })
/** *** */ ]))

View File

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

View File

@ -0,0 +1,3 @@
<view class="{{extClass}}">
<slot></slot>
</view>

View File

@ -0,0 +1,176 @@
module.exports =
/** *** */ (function (modules) { // webpackBootstrap
/** *** */ // The module cache
/** *** */ const 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)
/** *** */ const 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
/** *** */ const ns = Object.create(null)
/** *** */ __webpack_require__.r(ns)
/** *** */ Object.defineProperty(ns, 'default', {enumerable: true, value})
/** *** */ if (mode & 2 && typeof value !== 'string') for (const 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) {
/** *** */ const 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__) {
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() {
const data = this.data
this.setData({
currentImgs: data.imgUrls
})
},
methods: {
change(e) {
this.setData({
current: e.detail.current
})
this.triggerEvent('change', {
current: e.detail.current
}, {})
},
deleteImg() {
const data = this.data
const imgs = data.currentImgs
const url = imgs.splice(data.current, 1)
this.triggerEvent('delete', {
url: url[0],
index: data.current
}, {})
if (imgs.length === 0) {
// @ts-ignore
this.hideGallery()
return
}
this.setData({
current: 0,
currentImgs: imgs
})
},
hideGallery() {
const data = this.data
if (data.hideOnClick) {
this.setData({
show: false
})
this.triggerEvent('hide', {}, {})
}
}
}
})
/***/ })
/** *** */}))

View File

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

View File

@ -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="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 bindtap="deleteImg" class="weui-gallery__del">删除</navigator>
</view>
</view>

View File

@ -0,0 +1 @@
.weui-gallery{display:none}.weui-gallery_show.weui-gallery{display:flex}

View File

@ -0,0 +1,145 @@
/** *** */ (function (modules) { // webpackBootstrap
/** *** */ // The module cache
/** *** */ const 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)
/** *** */ const 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
/** *** */ const ns = Object.create(null)
/** *** */ __webpack_require__.r(ns)
/** *** */ Object.defineProperty(ns, 'default', {enumerable: true, value})
/** *** */ if (mode & 2 && typeof value !== 'string') for (const 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) {
/** *** */ const 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__) {
Component({
options: {
addGlobalClass: true,
pureDataPattern: /^_/
},
properties: {
extClass: {
type: String,
value: ''
},
grids: {
type: Array,
value: [],
}
},
data: {
innerGrids: [],
_defaultGridProps: {
target: 'self',
url: '',
openType: 'navigate',
delta: 1,
appId: '',
path: '',
extraData: '',
version: 'release',
hoverClass: 'navigator-hover',
hoverStopPropagation: false,
hoverStartTime: 50,
hoverStayTime: 600,
bindsuccess() {},
bindfail() {},
bindcomplete() {}
}
},
ready() {},
lifetimes: {
attached() {
if (this.data.grids) {
this.setData({
innerGrids: this.data.grids.map(grid => Object.assign({}, this.data._defaultGridProps, grid))
})
}
}
}
})
/***/ })
/** *** */}))

View File

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

View File

@ -0,0 +1,26 @@
<view class="weui-grids {{extClass}}">
<block wx:for="{{innerGrids}}" wx:key="index">
<navigator
class="weui-grid"
target="{{item.target}}"
url="{{item.url}}"
open-type="{{item.openType}}"
app-id="{{item.appId}}"
path="{{item.path}}"
extra-data="{{item.extraData}}"
version="{{item.version}}"
hover-class="{{item.hoverClass}}"
hover-stop-propagation="{{item.hoverStopPropagation}}"
hover-start-time="{{item.hoverStartTime}}"
hover-stay-time="{{item.hoverStayTime}}"
bindsuccess="{{item.bindsuccess}}"
bindfail="{{item.bindfail}}"
bindcomplete="{{item.bindcomplete}}"
>
<view class="weui-grid__icon">
<image class="weui-grid__icon_img" src="{{item.imgUrl}}" alt></image>
</view>
<view class="weui-grid__label">{{item.text}}</view>
</navigator>
</block>
</view>

View File

@ -0,0 +1 @@
.weui-grid .weui-grid__icon_img{width:100%;height:100%}

File diff suppressed because one or more lines are too long

View File

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

View File

@ -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>

View File

@ -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}

View File

@ -0,0 +1,156 @@
const throttle = function throttle(func, wait, options) {
let context = void 0
let args = void 0
let result = void 0
let timeout = null
let previous = 0
if (!options) options = {}
const later = function later() {
previous = options.leading === false ? 0 : Date.now()
timeout = null
result = func.apply(context, args)
if (!timeout) context = args = null
}
return function () {
const now = Date.now()
if (!previous && options.leading === false) previous = now
const remaining = wait - (now - previous)
context = this
args = arguments
if (remaining <= 0 || remaining > wait) {
clearTimeout(timeout)
timeout = null
previous = now
result = func.apply(context, args)
if (!timeout) context = args = null
} else if (!timeout && options.trailing !== false) {
timeout = setTimeout(later, remaining)
}
return result
}
}
Component({
behaviors: [],
options: {
addGlobalClass: true,
pureDataPattern: /^_/
},
properties: {
list: {
type: Array,
value: [],
observer: function observer(newVal) {
const _this = this
if (newVal.length === 0) return
const data = this.data
const alphabet = data.list.map(function (item) {
return item.alpha
})
this.setData({
alphabet,
current: alphabet[0]
}, function () {
_this.computedSize()
})
}
},
vibrated: {
type: Boolean,
value: true
}
},
data: {
windowHeight: 612,
current: 'A',
intoView: '',
touching: false,
alphabet: [],
_tops: [],
_anchorItemH: 0,
_anchorItemW: 0,
_anchorTop: 0,
_listUpperBound: 0
},
lifetimes: {
created() {
},
attached() {
this.__scrollTo = throttle(this._scrollTo, 100, {})
this.__onScroll = throttle(this._onScroll, 100, {})
const _wx$getSystemInfoSync = wx.getSystemInfoSync(); const
windowHeight = _wx$getSystemInfoSync.windowHeight
this.setData({windowHeight})
},
},
methods: {
choose(e) {
const item = e.target.dataset.item
this.triggerEvent('choose', {item})
},
scrollTo(e) {
this.__scrollTo(e)
},
_scrollTo(e) {
const data = this.data
const clientY = e.changedTouches[0].clientY
const index = Math.floor((clientY - data._anchorTop) / data._anchorItemH)
const current = data.alphabet[index]
this.setData({current, intoView: current, touching: true})
if (data.vibrated) wx.vibrateShort()
},
computedSize() {
const data = this.data
const query = this.createSelectorQuery()
query.selectAll('.city_list_item').boundingClientRect(function (rects) {
const result = rects
data._tops = result.map(function (item) {
return item.top
})
}).exec()
query.select('.anchor-list').boundingClientRect(function (rect) {
data._anchorItemH = rect.height / data.alphabet.length
data._anchorItemW = rect.width
data._anchorTop = rect.top
}).exec()
query.select('.page-select-city').boundingClientRect(function (rect) {
data._listUpperBound = rect.top
})
},
removeTouching: function removeTouching() {
const _this2 = this
setTimeout(function () {
_this2.setData({touching: false})
}, 150)
},
onScroll: function onScroll(e) {
this.__onScroll(e)
},
_onScroll: function _onScroll(e) {
const data = this.data
const _tops = data._tops; const
alphabet = data.alphabet
const scrollTop = e.detail.scrollTop
let current = ''
if (scrollTop < _tops[0]) {
current = alphabet[0]
} else {
for (let i = 0, len = _tops.length; i < len - 1; i++) {
if (scrollTop >= _tops[i] && scrollTop < _tops[i + 1]) {
current = alphabet[i]
}
}
}
if (!current) current = alphabet[alphabet.length - 1]
this.setData({current})
}
}
})

View File

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

View File

@ -0,0 +1,33 @@
<scroll-view class="page page-select-city" style="height: {{windowHeight}}px;" enable-back-to-top scroll-into-view="{{intoView}}" scroll-y bindscroll="onScroll">
<view>
<slot></slot>
</view>
<view class="city_list_item" wx:for="{{list}}" wx:key="alpha" id="{{item.alpha}}">
<view class="city-group__title font-size-26 tips-color">{{item.alpha}}</view>
<view class="city-group__content">
<view class="city-group__list">
<block wx:for="{{item.subItems}}" wx:for-item="subItem" wx:key="name">
<view
class="city-group__item thin-border-bottom"
hover-class="bg-highlight"
data-item="{{subItem}}"
bindtap="choose">
{{subItem.name}}
</view>
</block>
</view>
</view>
</view>
</scroll-view>
<view class="anchor-bar__wrp wx-flex" catchtouchstart='scrollTo' catchtouchmove='scrollTo' catchtouchend='removeTouching'>
<view class="anchor-bar wx-flex__item">
<view class="anchor-list">
<block wx:for="{{alphabet}}" wx:key="*this" wx:for-item="alpha">
<view class="anchor-item {{current == alpha ? ( touching ? 'selected tapped' : 'selected' ): ''}}" data-alpha="{{alpha}}">
<view class="anchor-item__inner">{{alpha}}</view>
<view class="anchor-item__pop">{{alpha}}</view>
</view>
</block>
</view>
</view>
</view>

View File

@ -0,0 +1,216 @@
.wx-flex {
display: flex;
align-items: center
}
.wx-flex__item {
flex: 1
}
.thin-border-bottom {
position: relative
}
.thin-border-bottom:after {
content: "";
position: absolute;
left: 0;
bottom: 0;
right: 0;
height: 1px;
border-bottom: 1px solid #EAEAEA;
color: #e5e5e5;
-webkit-transform-origin: 0 0;
transform-origin: 0 0;
-webkit-transform: scaleY(.5);
transform: scaleY(.5);
z-index: 2
}
.thin-border-top {
position: relative
}
.thin-border-top:after {
content: "";
position: absolute;
left: 0;
top: 0;
right: 0;
height: 1px;
border-bottom: 1px solid #EAEAEA;
color: #e5e5e5;
-webkit-transform-origin: 0 0;
transform-origin: 0 0;
-webkit-transform: scaleY(.5);
transform: scaleY(.5);
z-index: 2
}
.square-tag {
color: #9a9a9a;
text-align: center;
height: 30px;
line-height: 30px;
box-sizing: border-box;
border-radius: 2px;
background-color: #f7f7f7;
font-size: 12px;
position: relative
}
.square-tag:after {
content: "";
width: 200%;
height: 200%;
border: 1px solid #f7f7f7;
transform: scale(.5);
transform-origin: 0 0;
position: absolute;
left: 0;
top: 0;
box-sizing: border-box;
border-radius: 4px
}
.square-tag.selected {
background: rgba(26, 173, 25, 0.1);
color: #1AAD19
}
.square-tag.selected:after {
border: 1px solid #1AAD19
}
.select-city__hd {
padding: 0 15px;
position: fixed;
height: 50px;
background-color: #fff;
left: 0;
right: 0;
z-index: 990
}
.select-city__hd.thin-border-bottom:after {
left: 12px;
right: 12px
}
.current-city__name {
display: inline-block;
margin-right: 10px;
margin-left: 11px
}
.city-group_part .city-group__content {
padding: 0 15px
}
.city-group_part .city-group__title {
padding-bottom: 12px
}
.city-group__title {
padding: 12px 12px 11px
}
.city-group__content {
font-size: 0
}
.square-tag {
width: 100px;
display: inline-block;
margin-right: 12px;
margin-bottom: 12px;
height: 40px;
line-height: 40px;
font-size: 15px;
color: #000;
background-color: rgba(0, 0, 0, 0.02);
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis
}
.city-group__item {
padding: 15px 12px;
font-size: 15px
}
.city-group__item.thin-border-bottom:after {
left: 12px
}
.city-group_all {
padding-bottom: 50px
}
.fixed__top {
position: fixed;
top: 0
}
.anchor-bar__wrp {
position: fixed;
top: 0;
bottom: 0;
right: 0;
width: 30px;
z-index: 999
}
.anchor-item {
font-size: 0;
text-align: center;
position: relative
}
.anchor-item__inner {
line-height: 14px;
height: 14px;
width: 14px;
border-radius: 50%;
display: inline-block;
font-size: 10px;
margin: 1px 0;
font-weight: 500
}
.tapped .anchor-item__pop {
display: block
}
.anchor-item__pop {
position: absolute;
font-size: 62px;
width: 50px;
height: 50px;
line-height: 50px;
color: #fff;
background-color: #C9C9C9;
border-radius: 50%;
right: 40px;
top: 50%;
transform: translateY(-50%);
display: none
}
.anchor-item__pop:after {
content: "";
display: block;
position: absolute;
width: 0;
height: 0;
left: 40px;
border: 20px solid;
border-color: transparent transparent transparent #C9C9C9;
top: 50%;
transform: translateY(-50%)
}
.anchor-item.selected .anchor-item__inner {
color: #fff;
background-color: #1aad19
}

View File

@ -0,0 +1,93 @@
module.exports =
/** *** */ (function (modules) { // webpackBootstrap
/** *** */ // The module cache
/** *** */ const 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)
/** *** */ const 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
/** *** */ const ns = Object.create(null)
/** *** */ __webpack_require__.r(ns)
/** *** */ Object.defineProperty(ns, 'default', {enumerable: true, value})
/** *** */ if (mode & 2 && typeof value !== 'string') for (const 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) {
/** *** */ const 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 = 27)
/** *** */ }({
/***/ 27:
/***/ (function (module, exports, __webpack_require__) {
exports.__esModule = true
/***/ })
/** *** */}))

View File

@ -0,0 +1,180 @@
module.exports =
/** *** */ (function (modules) { // webpackBootstrap
/** *** */ // The module cache
/** *** */ const 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)
/** *** */ const 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
/** *** */ const ns = Object.create(null)
/** *** */ __webpack_require__.r(ns)
/** *** */ Object.defineProperty(ns, 'default', {enumerable: true, value})
/** *** */ if (mode & 2 && typeof value !== 'string') for (const 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) {
/** *** */ const 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__) {
Component({
options: {
addGlobalClass: true
},
properties: {
extClass: {
type: String,
value: ''
},
show: {
type: Boolean,
value: true,
observer(newValue) {
this._computedStyle(newValue, this.data.animated)
}
},
animated: {
type: Boolean,
value: false,
observer(newValue) {
this._computedStyle(this.data.show, newValue)
}
},
duration: {
// 过渡动画时间
type: Number,
value: 350
},
type: {
type: String,
value: 'dot-gray' // 取值dot-white、dot-gray、circle
},
tips: {
// type是circle的时候才有效
type: String,
value: '加载中'
}
},
data: {
animationData: {},
animationInstance: {},
displayStyle: 'none'
},
methods: {
_computedStyle(show, animated) {
if (!show) {
if (!animated) {
this.setData({
displayStyle: 'none'
})
} else {
this._startAnimation()
}
} else {
this.setData({
displayStyle: ''
})
}
},
_startAnimation() {
setTimeout(() => {
const data = this.data
const animation = data.animationInstance
animation.height(0).step()
this.setData({
animationData: animation.export()
})
}, 0)
}
},
lifetimes: {
attached() {
const data = this.data
const animationInstance = wx.createAnimation({
duration: data.duration,
timingFunction: 'ease'
})
this.setData({
animationInstance
})
this._computedStyle(this.data.show, this.data.animated)
}
}
})
/***/ })
/** *** */}))

View File

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

View File

@ -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>

View File

@ -0,0 +1 @@
.wx_loading_view{display:flex;justify-content:center;align-items:center;overflow:hidden}.loading{color:rgba(255,255,255,0.9);font-size:17px;text-align:center}.loading_view_translation{transition:height .2s .3s ease}

View File

@ -0,0 +1,127 @@
module.exports =
/** *** */ (function (modules) { // webpackBootstrap
/** *** */ // The module cache
/** *** */ const 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)
/** *** */ const 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
/** *** */ const ns = Object.create(null)
/** *** */ __webpack_require__.r(ns)
/** *** */ Object.defineProperty(ns, 'default', {enumerable: true, value})
/** *** */ if (mode & 2 && typeof value !== 'string') for (const 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) {
/** *** */ const 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__) {
Component({
options: {
addGlobalClass: true,
multipleSlots: true
},
properties: {
title: {
type: String,
value: ''
},
type: {
type: String,
value: ''
},
icon: {
// 可以自行设置 icon, 设置icon 之后type 失效
type: String,
value: ''
},
desc: {
type: String,
value: ''
},
extClass: {
type: String,
value: ''
},
size: {
// 可以自行设置 icon, 设置icon 之后type 失效
type: Number,
value: 64
}
},
data: {}
})
/***/ })
/** *** */}))

View File

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

View File

@ -0,0 +1,28 @@
<view class="weui-msg {{extClass}}">
<view class="weui-msg__icon-area">
<icon type="{{type}}" size="{{size}}" wx:if="{{type}}"></icon>
<image class="weui-msg__icon-img" 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__tips-area">
<view class="weui-msg__tips">
<slot name="tips"></slot>
</view>
</view>
<view class="weui-msg__extra-area">
<view class="weui-footer">
<slot name="footer"></slot>
</view>
</view>
</view>

View File

@ -0,0 +1 @@
.weui-msg__icon-img{width:95px;height:95px}

View File

@ -0,0 +1,188 @@
module.exports =
/** *** */ (function (modules) { // webpackBootstrap
/** *** */ // The module cache
/** *** */ const 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)
/** *** */ const 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
/** *** */ const ns = Object.create(null)
/** *** */ __webpack_require__.r(ns)
/** *** */ Object.defineProperty(ns, 'default', {enumerable: true, value})
/** *** */ if (mode & 2 && typeof value !== 'string') for (const 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) {
/** *** */ const 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__) {
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
},
// 显示隐藏的时候opacity动画效果
animated: {
type: Boolean,
value: true
},
// 显示隐藏导航隐藏的时候navigation-bar的高度占位还在
show: {
type: Boolean,
value: true,
observer: '_showChange'
},
delta: {
type: Number,
value: 1
}
},
data: {
displayStyle: ''
},
attached() {
const isSupport = !!wx.getMenuButtonBoundingClientRect
const rect = wx.getMenuButtonBoundingClientRect ? wx.getMenuButtonBoundingClientRect() : null
wx.getSystemInfo({
success: res => {
const ios = !!(res.system.toLowerCase().search('ios') + 1)
this.setData({
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(show) {
const animated = this.data.animated
let 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
})
},
back() {
const data = this.data
if (data.delta) {
wx.navigateBack({
delta: data.delta
})
}
this.triggerEvent('back', {
delta: data.delta
}, {})
}
}
})
/***/ })
/** *** */}))

View File

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

View File

@ -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>

View File

@ -0,0 +1,7 @@
{
"name": "weui-miniprogram",
"version": "1.0.0",
"description": "小程序 WeUI 组件库",
"author": "xushengni,tomylin,cunjinli,rockhou",
"license": "MIT"
}

View File

@ -0,0 +1,106 @@
module.exports =
/** *** */ (function (modules) { // webpackBootstrap
/** *** */ // The module cache
/** *** */ const 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)
/** *** */ const 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
/** *** */ const ns = Object.create(null)
/** *** */ __webpack_require__.r(ns)
/** *** */ Object.defineProperty(ns, 'default', {enumerable: true, value})
/** *** */ if (mode & 2 && typeof value !== 'string') for (const 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) {
/** *** */ const 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__) {
Component({
properties: {},
relations: {
'../col/index': {
type: 'child'
}
},
data: {
classStyle: ''
},
attached: function attached() {},
methods: {}
})
/***/ })
/** *** */}))

View File

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

View File

@ -0,0 +1,3 @@
<span class="weui-row-before"></span>
<slot></slot>
<span class="weui-row-after"></span>

View File

@ -0,0 +1 @@
:host{position:relative;box-sizing:border-box;width:100%}.weui-row-before{display:table}.weui-row-after{display:table;clear:both;content:""}

View File

@ -0,0 +1,218 @@
module.exports =
/** *** */ (function (modules) { // webpackBootstrap
/** *** */ // The module cache
/** *** */ const 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)
/** *** */ const 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
/** *** */ const ns = Object.create(null)
/** *** */ __webpack_require__.r(ns)
/** *** */ Object.defineProperty(ns, 'default', {enumerable: true, value})
/** *** */ if (mode & 2 && typeof value !== 'string') for (const 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) {
/** *** */ const 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__) {
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() {
// @ts-ignore
this.setData({
value: '',
focus: true,
result: []
}) // @ts-ignore
this.triggerEvent('clear')
},
inputFocus(e) {
// this.setData({
// searchState: true
// })
// @ts-ignore
this.triggerEvent('focus', e.detail)
},
inputBlur(e) {
this.setData({
focus: false
})
this.triggerEvent('blur', e.detail)
},
showInput() {
this.setData({
focus: true,
searchState: true
})
},
hideInput() {
this.setData({
searchState: false
})
},
// @ts-ignore
inputChange(e) {
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(() => {
this.data.search(e.detail.value).then(json => {
this.setData({
result: json
})
}).catch(err => {
console.error('search error', err)
})
}, this.data.throttle)
},
selectResult(e) {
const {
index
} = e.currentTarget.dataset
const item = this.data.result[index]
this.triggerEvent('selectresult', {
index,
item
})
}
}
})
/***/ })
/** *** */}))

View File

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

View File

@ -0,0 +1,19 @@
<view class="weui-search-bar {{searchState ? 'weui-search-bar_focusing' : ''}} {{extClass}}">
<view class="weui-search-bar__form">
<view class="weui-search-bar__box">
<icon class="weui-icon-search" 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" />
<text class="weui-icon-clear" wx:if="{{value.length > 0}}" bindtap="clearInput"></text>
</view>
<label class="weui-search-bar__label" bindtap="showInput">
<icon class="weui-icon-search" type="search" size="12"></icon>
<text class="weui-search-bar__text">搜索</text>
</label>
</view>
<view wx:if="{{cancel && searchState}}" class="weui-search-bar__cancel-btn" bindtap="hideInput">{{cancelText}}</view>
</view>
<mp-cells ext-class=" {{'searchbar-result ' + extClass}}" wx:if="{{searchState && result.length > 0}}">
<mp-cell bindtap="selectResult" body-class="weui-cell_primary" data-index="{{index}}" wx:for="{{result}}" wx:key="index" hover>
<view>{{item.text}}</view>
</mp-cell>
</mp-cells>

View File

@ -0,0 +1 @@
.weui-search-bar__label text{display:inline-block;font-size:14px;vertical-align:middle}

View File

@ -0,0 +1,64 @@
Component({
/**
* 组件的属性列表
*/
properties: {
space: {
type: String,
value: ''
},
decode: {
type: Boolean,
value: false
},
placement: {
type: String,
value: 'top'
},
showCopyBtn: {
type: Boolean,
value: false
},
value: {
type: String,
value: ''
}
},
observers: {
onDocumentTap() {
this.setData({
showToolTip: false
})
}
},
/**
* 组件的初始数据
*/
data: {
showToolTip: false
},
/**
* 组件的方法列表
*/
methods: {
handleLongPress() {
if (!this.data.showCopyBtn) return
this.setData({
showToolTip: true,
})
},
handleCopy() {
this.setData({
showToolTip: false
})
wx.setClipboardData({
data: this.data.value,
})
this.triggerEvent('copy', {})
},
stopPropagation: function stopPropagation(e) {}
}
})

View File

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

View File

@ -0,0 +1,22 @@
<wxs src="./select-text.wxs" module="computed" />
<view
class="weui-select-text"
style="{{computed.containerStyle({showToolTip, showCopyBtn, activeBgColor})}}"
catch:tap="stopPropagation"
>
<text
selectable="{{!showCopyBtn}}"
space="{{space}}"
decode="{{decode}}"
catch:longpress="handleLongPress"
>{{value}}</text>
<view
wx:if="{{showToolTip}}"
class="weui-tooltip weui-tooltip__{{placement}}"
style="z-index: {{zIndex}};"
catch:tap="handleCopy"
>
复制
</view>
</view>

View File

@ -0,0 +1,10 @@
function containerStyle(data) {
if (data.showToolTip && data.showCopyBtn) {
return 'background-color: ' + data.activeBgColor
}
return ''
}
module.exports = {
containerStyle: containerStyle,
}

View File

@ -0,0 +1,91 @@
.weui-select-text {
display: inline;
position: relative
}
.weui-tooltip {
box-sizing: border-box;
width: 60px;
background-color: #000000;
color: #ffffff;
text-align: center;
padding: 5px 0;
border-radius: 6px;
position: absolute;
font-size: 14px
}
.weui-tooltip__top {
left: 50%;
top: 0;
transform: translate(-50%, -100%);
margin-top: -10px
}
.weui-tooltip__top::after {
content: " ";
position: absolute;
top: 100%;
left: 50%;
transform: translate(-50%, 0);
border-width: 5px;
border-style: solid;
border-color: black transparent transparent transparent
}
.weui-tooltip__bottom {
left: 50%;
top: 100%;
transform: translate(-50%, 0);
margin-top: 10px
}
.weui-tooltip__bottom::after {
content: " ";
position: absolute;
top: 0;
left: 50%;
transform: translate(-50%, -100%);
border-width: 5px;
border-style: solid;
border-color: transparent transparent black transparent
}
.weui-tooltip__left {
left: 0;
top: 50%;
transform: translate(-100%, -50%);
margin-left: -10px
}
.weui-tooltip__left::after {
content: " ";
position: absolute;
top: 50%;
left: 100%;
transform: translate(0, -50%);
border-width: 5px;
border-style: solid;
border-color: transparent transparent transparent black
}
.weui-tooltip__right {
left: 100%;
top: 50%;
transform: translate(0, -50%);
margin-left: 10px
}
.weui-tooltip__right::after {
content: " ";
position: absolute;
top: 50%;
left: 0;
transform: translate(-100%, -50%);
border-width: 5px;
border-style: solid;
border-color: transparent black transparent transparent
}
textarea {
height: 16px;
}

View File

@ -0,0 +1,47 @@
// components/sign-up-popup/index.js
Component({
/**
* 组件的属性列表
*/
properties: {},
/**
* 组件的初始数据
*/
data: {
visible: false,
num: 0,
userList: [],
},
/**
* 组件的方法列表
*/
methods: {
/**
* @param {Array} userList 用户列表
*/
open(userList, totalCount) {
this.setData({
visible: true,
userList: userList,
num: totalCount
});
},
handleClick() {
this.setData({
visible: false,
});
},
onVisibleChange({
detail: {
visible
}
}) {
console.log(visible);
this.setData({
visible,
});
},
},
});

View File

@ -0,0 +1,7 @@
{
"component": true,
"usingComponents": {
"t-icon": "tdesign-miniprogram/icon/icon",
"t-popup": "tdesign-miniprogram/popup/popup"
}
}

View File

@ -0,0 +1,15 @@
<t-popup visible="{{visible}}" bind:visible-change="onVisibleChange" placement="bottom" close-btn>
<view class="sup-main">
<view class="sup-header">
<view class="sup-title">已有{{num}}人购买该课程</view>
</view>
<scroll-view class="sup-body" scroll-y>
<view class="sup-list">
<view wx:for="{{userList}}" wx:key="index" class="sup-user-item">
<image class="sup-user-head" src="{{item.avatarUrl}}" />
<view>{{item.studentName}}</view>
</view>
</view>
</scroll-view>
</view>
</t-popup>

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