diff --git a/app.js b/app.js index 7ae2340..ccfb7a0 100755 --- a/app.js +++ b/app.js @@ -88,9 +88,10 @@ App({ GetUserInfo(res){ var that = this; return new Promise((resolve, reject) => { - that.globalData.jwt_token = res.data.token; - that.globalData.user_id = res.data.user_id; - that.globalData.finish_user_info = res.data.finish_user_info=='1'?true:false; + let resp = res.data.data; + that.globalData.jwt_token = resp.token; + that.globalData.user_id = resp.user_id; + that.globalData.finish_user_info = resp.finish_user_info==1?true:false; wx.getSetting({ success: function (res) { var statu = res.authSetting; @@ -136,14 +137,6 @@ App({ }); }) }, - timestampToTime(timestamp) { - // 时间格式化 - var date = new Date(timestamp);//时间戳为10位需*1000,时间戳为13位的话不需乘1000 - var Y = date.getFullYear() + '-'; - var M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + '-'; - var D = date.getDate(); - return Y+M+D; - }, /** * @return {string} */ @@ -222,6 +215,7 @@ App({ WxHttpRequestPOST(url,data,successback,failback){ // 封装post请求 data['jwt_token'] = this.globalData.jwt_token; + console.log(data) wx.request({ url: this.globalData.api_host + url, data: data, @@ -290,58 +284,9 @@ App({ phoneNumber: phone }) }, - get_show_time(time){ - var new_time = time.split('T'); - return new_time[0] + ' ' + new_time[1].substr(0,8) - }, - get_html_imgs(html){ - var reimg=//gi; - let arr=html.match(reimg); - let imgs = []; - if(arr){ - for(let i=0;i]*>/gi,"$1")) - } - } - return imgs - }, - handlePublishTimeDesc(curTime, post_modified){ - // 拿到当前时间戳和发布时的时间戳,然后得出时间戳差 - // var postTime = new Date(post_modified); - post_modified=post_modified.replace(/-/g, '/'); // 解决ios 不识别xxxx-xx-xx格式 - var postTime = new Date(post_modified); - var timeDiff = curTime.getTime() - postTime.getTime(); - // 单位换算 - var min = 60 * 1000; - var hour = min * 60; - var day = hour * 24; - var week = day * 7; - // 计算发布时间距离当前时间的周、天、时、分 - var exceedWeek = Math.floor(timeDiff/week); - var exceedDay = Math.floor(timeDiff/day); - var exceedHour = Math.floor(timeDiff/hour); - var exceedMin = Math.floor(timeDiff/min); - // 最后判断时间差到底是属于哪个区间,然后return - if(exceedWeek > 0){ - return post_modified; - }else{ - if(exceedDay < 7 && exceedDay > 0){ - return exceedDay + '天前'; - }else{ - if(exceedHour < 24 && exceedHour > 0){ - return exceedHour + '小时前'; - }else{ - if(exceedMin<=0){ - return "刚刚" - } - return exceedMin + '分钟前'; - } - } - } - }, globalData: { login_redirect:false, - api_host:'https://api.donghao.club/api/', + api_host:'http://127.0.0.1:8000/api/', discuss_page_run:false, has_pre: false, index_new_city:false, diff --git a/app.wxss b/app.wxss index f33971f..61be215 100755 --- a/app.wxss +++ b/app.wxss @@ -22,8 +22,8 @@ page{ } .empty image{ align-self: center; - width: 300rpx; - height: 300rpx; + width: 400rpx; + height: 400rpx; } ::-webkit-scrollbar{ width: 0; @@ -154,7 +154,6 @@ page{ } .title{ padding: 20rpx 0; - color: #878787; } .topbox{ justify-content: space-between; diff --git a/colorui/main.wxss b/colorui/main.wxss index 3e2fad4..c89bdce 100755 --- a/colorui/main.wxss +++ b/colorui/main.wxss @@ -1492,8 +1492,7 @@ button.icon.lg { font-size: 25rpx; position: relative; /* height: 60rpx; */ - line-height: 60rpx; - color: #ced6e0; + /*line-height: 60rpx;*/ } .cu-form-group input { @@ -2164,7 +2163,6 @@ scroll-view.cu-steps .cu-item { } .item-title{ margin: 20rpx 10rpx; - color: #ced6e0; font-size: 25rpx; } .margin-sm { @@ -2594,6 +2592,12 @@ scroll-view.cu-steps .cu-item { color: var(--black); } +.bg-green-grant{ +background: #6de195; + color: ghostwhite; + +} + .bg-olive { background-color: var(--olive); color: var(--white); diff --git a/dist/behaviors/countdown.js b/dist/behaviors/countdown.js deleted file mode 100755 index 2870d6c..0000000 --- a/dist/behaviors/countdown.js +++ /dev/null @@ -1,210 +0,0 @@ -module.exports = Behavior({ - behaviors: [], - properties: { - time: { - type: Date, - value: new Date().getTime() + 86400000, - observer:function(newVal,oldVal) { - if(newVal && !oldVal) { - this.getLatestTime(); - } - } - }, - status: { - type: Boolean, - value: true, - observer: function (newVal, oldVal, changedPath) { - if (newVal) { - this.init(); - } else if (!newVal) { - clearInterval(this.data.timer); - } - } - }, - timeType: { - type: String, - value: 'datetime' - }, - format: { - type: String, - value: '{%d}天{%h}时{%m}分{%s}秒' - }, - isZeroPadd: { - type: Boolean, - value: true, - }, - countdownType: { - type: String, - value: "normal" - } - }, - data: { - initAddTime: 0, - timer: null, - date: [], - }, - ready: function () { - this.getLatestTime(); - }, - - detached: function () { - clearInterval(this.data.timer); - }, - - pageLifetimes: { - hide() { - clearInterval(this.data.timer); - }, - show() { - this.getLatestTime(); - } - }, - - methods: { - // 自动补零 - zeroPadding(num) { - num = num.toString() - return num[1] ? num : '0' + num - }, - - init() { - clearInterval(this.data.timer); - const timer = setTimeout(() => { - this.getLatestTime.call(this); - }, 1000); - this.setData({ - timer - }) - }, - - getLatestTime() { - let { - time, - status, - timeType, - initAddTime, - countdownType, - } = this.data; - // IOS不支持2019-04-23 的日期格式 - let countDownTime = time - if (countdownType === "normal") { //当countdownType === normal时,不影响之前的代码 - if (timeType !== 'second') { - countDownTime = typeof time === 'string' ? countDownTime.replace(/-/g, '/') : countDownTime; - countDownTime = Math.ceil((new Date(countDownTime).getTime() - new Date().getTime()) / 1000); - } - - if (countDownTime < 0 && timeType !== 'second') { - this._getTimeValue(0); - this.CountdownEnd(); - return - } - - if (countDownTime - initAddTime > 0) { - this.getLatestForCountDown(countDownTime); - } else if (countDownTime - initAddTime < 0) { - this.getLatestForAddTime(countDownTime); - } else if (countDownTime - initAddTime === 0) { - if (initAddTime <= 0) { - this._getTimeValue(countDownTime); - } - this.CountdownEnd(); - } - - if (status && countDownTime - initAddTime !== 0) { - this.init.call(this); - } - - } else if (countdownType === "anniversary") { // 当countdownType === anniversary时,为纪念日模式 - if (timeType === "second") { // 纪念日模式不能设置timeType === second - console.error(`countdownType为${countdownType}类型时,不可设置timeType值为second`) - } else { - countDownTime = typeof time === 'string' ? countDownTime.replace(/-/g, '/') : countDownTime; - countDownTime = Math.ceil((new Date().getTime() - new Date(countDownTime).getTime()) / 1000); - if (countDownTime >= 0) { // countDownTime计算结果不能为负数 - this.getLatestForCountDown(countDownTime); - this.init.call(this); - } else { - console.error("time传值错误") - } - } - } else { // countdownType 不能设置为 normal,anniversary 以外的值 - console.error("错误的countdownType类型") - } - }, - - getLatestForAddTime(countDownTime) { - let { - initAddTime - } = this.data; - if (initAddTime !== Math.abs(countDownTime)) { - initAddTime++; - this._getTimeValue(initAddTime); - this.setData({ - initAddTime - }) - } - }, - - getLatestForCountDown(countDownTime) { - this._getTimeValue(countDownTime); - this.setData({ - time: this.data.timeType === 'second' ? --countDownTime : this.data.time, - }); - }, - - _getTimeValue(countDownTime) { - const { - format - } = this.data; - const date = []; - const fomatArray = format.split(/(\{.*?\})/); - const formatType = [{ - key: '{%d}', - type: 'day', - count: 86400 - }, { - key: '{%h}', - type: 'hour', - count: 3600 - }, { - key: '{%m}', - type: 'minute', - count: 60 - }, { - key: '{%s}', - type: 'second', - count: 1, - }]; - let diffSecond = countDownTime; - formatType.forEach(format => { - const index = this._findTimeName(fomatArray, format.key); - if (index === -1) return; - const name = fomatArray[index]; - const formatItem = { - type: format.type, - name, - value: parseInt(diffSecond / format.count) - }; - if (this.data.isZeroPadd) { - formatItem.value = this.zeroPadding(formatItem.value); - } - diffSecond %= format.count; - date.push(formatItem); - }); - this.setData({ - date - }); - return date; - }, - - _findTimeName(fomatArray, str) { - const index = fomatArray.indexOf(str); - if (index === -1) return -1; - return index + 1 - }, - - CountdownEnd() { - this.triggerEvent("linend", {}); - }, - } -}); \ No newline at end of file diff --git a/dist/behaviors/rules.js b/dist/behaviors/rules.js deleted file mode 100755 index 56aa0b5..0000000 --- a/dist/behaviors/rules.js +++ /dev/null @@ -1,98 +0,0 @@ -import Schema from '../common/async-validator/index'; -/** - * @param tipType String [toast , message , text] - */ -module.exports = Behavior({ - behaviors: [], - properties: { - // 校验 - rules: { - type: Object, - }, - tipType: { - type: String, - value: '' - } - }, - data: { - schema: '', - tipFun: { - 'message': 'showMessage', - 'toast': 'showToast', - }, - tipContent: { - 'message': 'content', - 'toast': 'title', - }, - errorText: '', - }, - - methods: { - initRules() { - const rulesName = this.data.name; - const { - rules - } = this.data; - if (!rules) return; - const schema = new Schema({ - [rulesName]: this.data.rules, - }); - this.setData({ - schema, - }); - }, - validatorData({ - value - }) { - const { - rules, - tipType, - tipFun, - tipContent - } = this.data; - - if (!rules) return; - const validateValue = { - [this.data.name]: value - }; - this.data.schema.validate(validateValue, (errors, fields) => { - - this.triggerEvent('linvalidate', { - errors, - isError: !!errors - }); - - if (errors && tipType) { - const funName = tipFun[tipType]; - const contentName = tipContent[tipType]; - if (tipType === 'text') { - this.setData({ - errorText: errors[0].message - }); - return; - } - - if (!wx.lin || !wx.lin[funName]) { - wx.showToast({ - icon: 'none', - title: `请在页面内引入${tipType}组件` - }) - return; - } - - wx.lin[funName] && wx.lin[funName]({ - [contentName]: errors[0].message, - duration: 1500, - mask: false, - }); - } else if (!errors && tipType) { - this.setData({ - errorText: '' - }); - } - - }); - - } - } -}) \ No newline at end of file diff --git a/dist/button/index.js b/dist/button/index.js deleted file mode 100755 index e472bdb..0000000 --- a/dist/button/index.js +++ /dev/null @@ -1,79 +0,0 @@ -Component({ - externalClasses: ['l-class', 'l-hover-class', 'l-img-class'], - properties: { - // button组建标识 - name: { - type: String, - value: 'lin' - }, - type: { - type: String, - value: 'default', - }, - plain: Boolean, - size: { - type: String, - value: 'medium', - }, - shape: { - type: String, - value: 'circle', - }, - disabled: { - type: Boolean, - value: false, - }, - special: { - type: Boolean, - value: false, - }, - loading: { - type: Boolean, - value: false, - }, - // 微信原生接口 - width:Number, - height:Number, - icon: String, - image: String, - iconStyle: { - type: String, - value: 'size:20;color:#3683D6' - }, - iconColor: String, - iconSize: String, - openType: String, - appParameter: String, - lang: String, - hoverStopPropagation: Boolean, - hoverStartTime: { - type: Number, - value: 20 - }, - hoverStayTime: { - type: Number, - value: 70 - }, - sessionFrom: { - type: String, - value: '' - }, - sendMessageTitle: String, - sendMessagePath: String, - sendMessageImg: String, - showMessageCard: Boolean, - formType: String - }, - methods: { - // button点击事件 - handleTap() { - if (this.data.disabled) return false; - this.triggerEvent('lintap'); - this.triggerEvent('lintapcatch',{},{ bubbles: true }); - }, - // 开放能力事件回调 - openTypeEvent(data) { - this.triggerEvent(data.type, data.detail, {}); - } - } - }); diff --git a/dist/button/index.json b/dist/button/index.json deleted file mode 100755 index c01e2d7..0000000 --- a/dist/button/index.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "component": true, - "usingComponents": { - "l-icon":"../icon/index" - } -} \ No newline at end of file diff --git a/dist/button/index.wxml b/dist/button/index.wxml deleted file mode 100755 index cfde528..0000000 --- a/dist/button/index.wxml +++ /dev/null @@ -1,37 +0,0 @@ - - \ No newline at end of file diff --git a/dist/button/index.wxss b/dist/button/index.wxss deleted file mode 100755 index 880eeda..0000000 --- a/dist/button/index.wxss +++ /dev/null @@ -1 +0,0 @@ -.btn-hover{opacity:.8}.l-btn{display:inline-flex;align-items:center;justify-content:center;white-space:nowrap;font-size:28rpx;position:relative;color:#fff;padding:0 12rpx;box-sizing:border-box}.l-btn-img-mini{width:30rpx;height:30rpx}.l-btn-img-medium{width:36rpx;height:36rpx}.l-btn-img-large{height:44rpx;width:44rpx}.l-btn-long{border-radius:0;margin:0;height:88rpx;width:750rpx}.l-btn-medium{height:72rpx;min-width:180rpx}.l-btn-large{height:88rpx;min-width:710rpx}.l-btn-mini{height:60rpx;min-width:140rpx;font-size:24rpx}.l-btn-default{background-color:#3963bc}.l-btn-success{background-color:#34bfa3}.l-btn-warning{background-color:#ffe57f;color:#333}.l-btn-error{background-color:#f4516c}.l-btn-square{border-radius:0}.l-btn-semicircle{border-radius:40rpx}.l-btn-large.l-btn-semicircle{border-radius:48rpx}.l-btn-mini.l-btn-semicircle{border-radius:30rpx}.l-btn-circle{border-radius:8rpx}.l-btn-large.l-btn-circle{border-radius:9.6rpx}.l-btn-mini.l-btn-circle{border-radius:6rpx}.l-btn-plain{background-color:#fff;color:#3963bc;border:2rpx solid #3963bc}.l-btn-success.l-btn-plain{background-color:#fff;color:#34bfa3;border:2rpx solid #34bfa3}.l-btn-error.l-btn-plain{background-color:#fff;color:#f4516c;border:2rpx solid #f4516c}.l-btn-warning.l-btn-plain{background-color:#fff;color:#ffe57f;border:2rpx solid #ffe57f}.l-btn-loading{opacity:.6;display:inline-block;vertical-align:middle;width:24rpx;height:24rpx;background:0 0;border-radius:50%;border:4rpx solid #fff;border-color:#fff #fff #fff transparent;animation:btn-spin .6s linear;animation-iteration-count:infinite}.l-btn-loading-default{border:4rpx solid #3963bc;border-color:#3963bc #3963bc #3963bc transparent}.l-btn-loading-success{border:4rpx solid #34bfa3;border-color:#34bfa3 #34bfa3 #34bfa3 transparent}.l-btn-loading-error{border:4rpx solid #f4516c;border-color:#f4516c #f4516c #f4516c transparent}.l-btn-loading-warning{border:4rpx solid #ffe57f;border-color:#ffe57f #ffe57f #ffe57f transparent}.l-btn-disabled{opacity:.8;background-color:#dee2e6}.icon{display:flex!important}.margin-mini{margin-right:10rpx}.margin-medium{margin-right:18rpx}.margin-large{margin-right:24rpx}@keyframes btn-spin{0%{transform:rotate(0)}100%{transform:rotate(360deg)}} \ No newline at end of file diff --git a/dist/common/async-validator/index.js b/dist/common/async-validator/index.js deleted file mode 100755 index dac8802..0000000 --- a/dist/common/async-validator/index.js +++ /dev/null @@ -1,258 +0,0 @@ -import { format, complementError, asyncMap, warning, deepMerge } from './util.js'; -import validators from './validator/index.js'; -import { messages as defaultMessages, newMessages } from './messages.js'; - -/** - * Encapsulates a validation schema. - * - * @param descriptor An object declaring validation rules - * for this schema. - */ -function Schema(descriptor) { - this.rules = null; - this._messages = defaultMessages; - this.define(descriptor); -} - -Schema.prototype = { - messages(messages) { - if (messages) { - this._messages = deepMerge(newMessages(), messages); - } - return this._messages; - }, - define(rules) { - if (!rules) { - throw new Error( - 'Cannot configure a schema with no rules'); - } - if (typeof rules !== 'object' || Array.isArray(rules)) { - throw new Error('Rules must be an object'); - } - this.rules = {}; - let z; - let item; - for (z in rules) { - if (rules.hasOwnProperty(z)) { - item = rules[z]; - this.rules[z] = Array.isArray(item) ? item : [item]; - } - } - }, - validate(source_, o = {}, oc) { - let source = source_; - let options = o; - let callback = oc; - if (typeof options === 'function') { - callback = options; - options = {}; - } - if (!this.rules || Object.keys(this.rules).length === 0) { - if (callback) { - callback(); - } - return; - } - function complete(results) { - let i; - let field; - let errors = []; - let fields = {}; - - function add(e) { - if (Array.isArray(e)) { - errors = errors.concat.apply(errors, e); - } else { - errors.push(e); - } - } - - for (i = 0; i < results.length; i++) { - add(results[i]); - } - if (!errors.length) { - errors = null; - fields = null; - } else { - for (i = 0; i < errors.length; i++) { - field = errors[i].field; - fields[field] = fields[field] || []; - fields[field].push(errors[i]); - } - } - callback(errors, fields); - } - - if (options.messages) { - let messages = this.messages(); - if (messages === defaultMessages) { - messages = newMessages(); - } - deepMerge(messages, options.messages); - options.messages = messages; - } else { - options.messages = this.messages(); - } - let arr; - let value; - const series = {}; - const keys = options.keys || Object.keys(this.rules); - keys.forEach((z) => { - arr = this.rules[z]; - value = source[z]; - arr.forEach((r) => { - let rule = r; - if (typeof (rule.transform) === 'function') { - if (source === source_) { - source = { ...source }; - } - value = source[z] = rule.transform(value); - } - if (typeof (rule) === 'function') { - rule = { - validator: rule, - }; - } else { - rule = { ...rule }; - } - rule.validator = this.getValidationMethod(rule); - rule.field = z; - rule.fullField = rule.fullField || z; - rule.type = this.getType(rule); - if (!rule.validator) { - return; - } - series[z] = series[z] || []; - series[z].push({ - rule, - value, - source, - field: z, - }); - }); - }); - const errorFields = {}; - asyncMap(series, options, (data, doIt) => { - const rule = data.rule; - let deep = (rule.type === 'object' || rule.type === 'array') && - (typeof (rule.fields) === 'object' || typeof (rule.defaultField) === 'object'); - deep = deep && (rule.required || (!rule.required && data.value)); - rule.field = data.field; - function addFullfield(key, schema) { - return { - ...schema, - fullField: `${rule.fullField}.${key}`, - }; - } - - function cb(e = []) { - let errors = e; - if (!Array.isArray(errors)) { - errors = [errors]; - } - if (errors.length) { - warning('async-validator:', errors); - } - if (errors.length && rule.message) { - errors = [].concat(rule.message); - } - - errors = errors.map(complementError(rule)); - - if (options.first && errors.length) { - errorFields[rule.field] = 1; - return doIt(errors); - } - if (!deep) { - doIt(errors); - } else { - // if rule is required but the target object - // does not exist fail at the rule level and don't - // go deeper - if (rule.required && !data.value) { - if (rule.message) { - errors = [].concat(rule.message).map(complementError(rule)); - } else if (options.error) { - errors = [options.error(rule, format(options.messages.required, rule.field))]; - } else { - errors = []; - } - return doIt(errors); - } - - let fieldsSchema = {}; - if (rule.defaultField) { - for (const k in data.value) { - if (data.value.hasOwnProperty(k)) { - fieldsSchema[k] = rule.defaultField; - } - } - } - fieldsSchema = { - ...fieldsSchema, - ...data.rule.fields, - }; - for (const f in fieldsSchema) { - if (fieldsSchema.hasOwnProperty(f)) { - const fieldSchema = Array.isArray(fieldsSchema[f]) ? - fieldsSchema[f] : [fieldsSchema[f]]; - fieldsSchema[f] = fieldSchema.map(addFullfield.bind(null, f)); - } - } - const schema = new Schema(fieldsSchema); - schema.messages(options.messages); - if (data.rule.options) { - data.rule.options.messages = options.messages; - data.rule.options.error = options.error; - } - schema.validate(data.value, data.rule.options || options, (errs) => { - doIt(errs && errs.length ? errors.concat(errs) : errs); - }); - } - } - - const res = rule.validator( - rule, data.value, cb, data.source, options); - if (res && res.then) { - res.then(() => cb(), e => cb(e)); - } - }, (results) => { - complete(results); - }); - }, - getType(rule) { - if (rule.type === undefined && (rule.pattern instanceof RegExp)) { - rule.type = 'pattern'; - } - if (typeof (rule.validator) !== 'function' && - (rule.type && !validators.hasOwnProperty(rule.type))) { - throw new Error(format('Unknown rule type %s', rule.type)); - } - return rule.type || 'string'; - }, - getValidationMethod(rule) { - if (typeof rule.validator === 'function') { - return rule.validator; - } - const keys = Object.keys(rule); - const messageIndex = keys.indexOf('message'); - if (messageIndex !== -1) { - keys.splice(messageIndex, 1); - } - if (keys.length === 1 && keys[0] === 'required') { - return validators.required; - } - return validators[this.getType(rule)] || false; - }, -}; - -Schema.register = function register(type, validator) { - if (typeof validator !== 'function') { - throw new Error('Cannot register a validator by type, validator is not a function'); - } - validators[type] = validator; -}; - -Schema.messages = defaultMessages; - -export default Schema; diff --git a/dist/common/async-validator/messages.js b/dist/common/async-validator/messages.js deleted file mode 100755 index 5117ce4..0000000 --- a/dist/common/async-validator/messages.js +++ /dev/null @@ -1,56 +0,0 @@ -export function newMessages() { - return { - default: 'Validation error on field %s', - required: '%s is required', - enum: '%s must be one of %s', - whitespace: '%s cannot be empty', - date: { - format: '%s date %s is invalid for format %s', - parse: '%s date could not be parsed, %s is invalid ', - invalid: '%s date %s is invalid', - }, - types: { - string: '%s is not a %s', - method: '%s is not a %s (function)', - array: '%s is not an %s', - object: '%s is not an %s', - number: '%s is not a %s', - date: '%s is not a %s', - boolean: '%s is not a %s', - integer: '%s is not an %s', - float: '%s is not a %s', - regexp: '%s is not a valid %s', - email: '%s is not a valid %s', - url: '%s is not a valid %s', - hex: '%s is not a valid %s', - }, - string: { - len: '%s must be exactly %s characters', - min: '%s must be at least %s characters', - max: '%s cannot be longer than %s characters', - range: '%s must be between %s and %s characters', - }, - number: { - len: '%s must equal %s', - min: '%s cannot be less than %s', - max: '%s cannot be greater than %s', - range: '%s must be between %s and %s', - }, - array: { - len: '%s must be exactly %s in length', - min: '%s cannot be less than %s in length', - max: '%s cannot be greater than %s in length', - range: '%s must be between %s and %s in length', - }, - pattern: { - mismatch: '%s value %s does not match pattern %s', - }, - clone() { - const cloned = JSON.parse(JSON.stringify(this)); - cloned.clone = this.clone; - return cloned; - }, - }; -} - -export const messages = newMessages(); diff --git a/dist/common/async-validator/rule/enum.js b/dist/common/async-validator/rule/enum.js deleted file mode 100755 index 00f0e1c..0000000 --- a/dist/common/async-validator/rule/enum.js +++ /dev/null @@ -1,22 +0,0 @@ -import * as util from '../util'; -const ENUM = 'enum'; - -/** - * Rule for validating a value exists in an enumerable list. - * - * @param rule The validation rule. - * @param value The value of the field on the source object. - * @param source The source object being validated. - * @param errors An array of errors that this rule may add - * validation errors to. - * @param options The validation options. - * @param options.messages The validation messages. - */ -function enumerable(rule, value, source, errors, options) { - rule[ENUM] = Array.isArray(rule[ENUM]) ? rule[ENUM] : []; - if (rule[ENUM].indexOf(value) === -1) { - errors.push(util.format(options.messages[ENUM], rule.fullField, rule[ENUM].join(', '))); - } -} - -export default enumerable; diff --git a/dist/common/async-validator/rule/index.js b/dist/common/async-validator/rule/index.js deleted file mode 100755 index 05572e8..0000000 --- a/dist/common/async-validator/rule/index.js +++ /dev/null @@ -1,15 +0,0 @@ -import required from './required.js'; -import whitespace from './whitespace.js'; -import type from './type.js'; -import range from './range.js'; -import enumRule from './enum.js'; -import pattern from './pattern.js'; - -export default { - required, - whitespace, - type, - range, - enum: enumRule, - pattern, -}; diff --git a/dist/common/async-validator/rule/pattern.js b/dist/common/async-validator/rule/pattern.js deleted file mode 100755 index 3dbe780..0000000 --- a/dist/common/async-validator/rule/pattern.js +++ /dev/null @@ -1,36 +0,0 @@ -import * as util from '../util'; - -/** - * Rule for validating a regular expression pattern. - * - * @param rule The validation rule. - * @param value The value of the field on the source object. - * @param source The source object being validated. - * @param errors An array of errors that this rule may add - * validation errors to. - * @param options The validation options. - * @param options.messages The validation messages. - */ -function pattern(rule, value, source, errors, options) { - if (rule.pattern) { - if (rule.pattern instanceof RegExp) { - // if a RegExp instance is passed, reset `lastIndex` in case its `global` - // flag is accidentally set to `true`, which in a validation scenario - // is not necessary and the result might be misleading - rule.pattern.lastIndex = 0; - if (!rule.pattern.test(value)) { - errors.push(util.format(options.messages.pattern.mismatch, - rule.fullField, value, rule.pattern)); - } - } else if (typeof rule.pattern === 'string') { - - const _pattern = new RegExp(rule.pattern.replace(/^\/|\/$/g,'')); - if (!_pattern.test(value)) { - errors.push(util.format(options.messages.pattern.mismatch, - rule.fullField, value, rule.pattern)); - } - } - } -} - -export default pattern; diff --git a/dist/common/async-validator/rule/range.js b/dist/common/async-validator/rule/range.js deleted file mode 100755 index 2b50a40..0000000 --- a/dist/common/async-validator/rule/range.js +++ /dev/null @@ -1,59 +0,0 @@ -import * as util from '../util'; - -/** - * Rule for validating minimum and maximum allowed values. - * - * @param rule The validation rule. - * @param value The value of the field on the source object. - * @param source The source object being validated. - * @param errors An array of errors that this rule may add - * validation errors to. - * @param options The validation options. - * @param options.messages The validation messages. - */ -function range(rule, value, source, errors, options) { - const len = typeof rule.len === 'number'; - const min = typeof rule.min === 'number'; - const max = typeof rule.max === 'number'; - // 正则匹配码点范围从U+010000一直到U+10FFFF的文字(补充平面Supplementary Plane) - const spRegexp = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g; - let val = value; - let key = null; - const num = typeof (value) === 'number'; - const str = typeof (value) === 'string'; - const arr = Array.isArray(value); - if (num) { - key = 'number'; - } else if (str) { - key = 'string'; - } else if (arr) { - key = 'array'; - } - // if the value is not of a supported type for range validation - // the validation rule rule should use the - // type property to also test for a particular type - if (!key) { - return false; - } - if (arr) { - val = value.length; - } - if (str) { - // 处理码点大于U+010000的文字length属性不准确的bug,如"𠮷𠮷𠮷".lenght !== 3 - val = value.replace(spRegexp, '_').length; - } - if (len) { - if (val !== rule.len) { - errors.push(util.format(options.messages[key].len, rule.fullField, rule.len)); - } - } else if (min && !max && val < rule.min) { - errors.push(util.format(options.messages[key].min, rule.fullField, rule.min)); - } else if (max && !min && val > rule.max) { - errors.push(util.format(options.messages[key].max, rule.fullField, rule.max)); - } else if (min && max && (val < rule.min || val > rule.max)) { - errors.push(util.format(options.messages[key].range, - rule.fullField, rule.min, rule.max)); - } -} - -export default range; diff --git a/dist/common/async-validator/rule/required.js b/dist/common/async-validator/rule/required.js deleted file mode 100755 index 4d9b409..0000000 --- a/dist/common/async-validator/rule/required.js +++ /dev/null @@ -1,21 +0,0 @@ -import * as util from '../util'; - -/** - * Rule for validating required fields. - * - * @param rule The validation rule. - * @param value The value of the field on the source object. - * @param source The source object being validated. - * @param errors An array of errors that this rule may add - * validation errors to. - * @param options The validation options. - * @param options.messages The validation messages. - */ -function required(rule, value, source, errors, options, type) { - if (rule.required && - (!source.hasOwnProperty(rule.field) || util.isEmptyValue(value, type || rule.type))) { - errors.push(util.format(options.messages.required, rule.fullField)); - } -} - -export default required; diff --git a/dist/common/async-validator/rule/type.js b/dist/common/async-validator/rule/type.js deleted file mode 100755 index d6a50d5..0000000 --- a/dist/common/async-validator/rule/type.js +++ /dev/null @@ -1,91 +0,0 @@ -import * as util from '../util'; -import required from './required'; - -/* eslint max-len:0 */ - -const pattern = { - // http://emailregex.com/ - email: /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/, - url: new RegExp('^(?!mailto:)(?:(?:http|https|ftp)://|//)(?:\\S+(?::\\S*)?@)?(?:(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[0-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]+-?)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]+-?)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:[a-z\\u00a1-\\uffff]{2,})))|localhost)(?::\\d{2,5})?(?:(/|\\?|#)[^\\s]*)?$', 'i'), - hex: /^#?([a-f0-9]{6}|[a-f0-9]{3})$/i, -}; - -const types = { - integer(value) { - return types.number(value) && parseInt(value, 10) === value; - }, - float(value) { - return types.number(value) && !types.integer(value); - }, - array(value) { - return Array.isArray(value); - }, - regexp(value) { - if (value instanceof RegExp) { - return true; - } - try { - return !!new RegExp(value); - } catch (e) { - return false; - } - }, - date(value) { - return typeof value.getTime === 'function' && - typeof value.getMonth === 'function' && - typeof value.getYear === 'function'; - }, - number(value) { - if (isNaN(value) || value === '') { - return false; - } - return true; - }, - object(value) { - return typeof (value) === 'object' && !types.array(value); - }, - method(value) { - return typeof (value) === 'function'; - }, - email(value) { - return typeof (value) === 'string' && !!value.match(pattern.email) && value.length < 255; - }, - url(value) { - return typeof (value) === 'string' && !!value.match(pattern.url); - }, - hex(value) { - return typeof (value) === 'string' && !!value.match(pattern.hex); - }, -}; - -/** - * Rule for validating the type of a value. - * - * @param rule The validation rule. - * @param value The value of the field on the source object. - * @param source The source object being validated. - * @param errors An array of errors that this rule may add - * validation errors to. - * @param options The validation options. - * @param options.messages The validation messages. - */ -function type(rule, value, source, errors, options) { - if (rule.required && value === undefined) { - required(rule, value, source, errors, options); - return; - } - const custom = ['integer', 'float', 'array', 'regexp', 'object', - 'method', 'email', 'number', 'date', 'url', 'hex' - ]; - const ruleType = rule.type; - if (custom.indexOf(ruleType) > -1) { - if (!types[ruleType](value)) { - errors.push(util.format(options.messages.types[ruleType], rule.fullField, rule.type)); - } - // straight typeof check - } else if (ruleType && typeof (value) !== rule.type) { - errors.push(util.format(options.messages.types[ruleType], rule.fullField, rule.type)); - } -} - -export default type; \ No newline at end of file diff --git a/dist/common/async-validator/rule/whitespace.js b/dist/common/async-validator/rule/whitespace.js deleted file mode 100755 index 0433723..0000000 --- a/dist/common/async-validator/rule/whitespace.js +++ /dev/null @@ -1,20 +0,0 @@ -import * as util from '../util'; - -/** - * Rule for validating whitespace. - * - * @param rule The validation rule. - * @param value The value of the field on the source object. - * @param source The source object being validated. - * @param errors An array of errors that this rule may add - * validation errors to. - * @param options The validation options. - * @param options.messages The validation messages. - */ -function whitespace(rule, value, source, errors, options) { - if (/^\s+$/.test(value) || value === '') { - errors.push(util.format(options.messages.whitespace, rule.fullField)); - } -} - -export default whitespace; diff --git a/dist/common/async-validator/util.js b/dist/common/async-validator/util.js deleted file mode 100755 index adf25ef..0000000 --- a/dist/common/async-validator/util.js +++ /dev/null @@ -1,177 +0,0 @@ -const formatRegExp = /%[sdj%]/g; - -export let warning = () => { -}; - -export function format(...args) { - let i = 1; - const f = args[0]; - const len = args.length; - if (typeof f === 'function') { - return f.apply(null, args.slice(1)); - } - if (typeof f === 'string') { - let str = String(f).replace(formatRegExp, (x) => { - if (x === '%%') { - return '%'; - } - if (i >= len) { - return x; - } - switch (x) { - case '%s': - return String(args[i++]); - case '%d': - return Number(args[i++]); - case '%j': - try { - return JSON.stringify(args[i++]); - } catch (_) { - return '[Circular]'; - } - break; - default: - return x; - } - }); - for (let arg = args[i]; i < len; arg = args[++i]) { - str += ` ${arg}`; - } - return str; - } - return f; -} - -function isNativeStringType(type) { - return type === 'string' || - type === 'url' || - type === 'hex' || - type === 'email' || - type === 'pattern'; -} - -export function isEmptyValue(value, type) { - if (value === undefined || value === null) { - return true; - } - if (type === 'array' && Array.isArray(value) && !value.length) { - return true; - } - if (isNativeStringType(type) && typeof value === 'string' && !value) { - return true; - } - return false; -} - -export function isEmptyObject(obj) { - return Object.keys(obj).length === 0; -} - -function asyncParallelArray(arr, func, callback) { - const results = []; - let total = 0; - const arrLength = arr.length; - - function count(errors) { - results.push.apply(results, errors); - total++; - if (total === arrLength) { - callback(results); - } - } - - arr.forEach((a) => { - func(a, count); - }); -} - -function asyncSerialArray(arr, func, callback) { - let index = 0; - const arrLength = arr.length; - - function next(errors) { - if (errors && errors.length) { - callback(errors); - return; - } - const original = index; - index = index + 1; - if (original < arrLength) { - func(arr[original], next); - } else { - callback([]); - } - } - - next([]); -} - -function flattenObjArr(objArr) { - const ret = []; - Object.keys(objArr).forEach((k) => { - ret.push.apply(ret, objArr[k]); - }); - return ret; -} - -export function asyncMap(objArr, option, func, callback) { - if (option.first) { - const flattenArr = flattenObjArr(objArr); - return asyncSerialArray(flattenArr, func, callback); - } - let firstFields = option.firstFields || []; - if (firstFields === true) { - firstFields = Object.keys(objArr); - } - const objArrKeys = Object.keys(objArr); - const objArrLength = objArrKeys.length; - let total = 0; - const results = []; - const next = (errors) => { - results.push.apply(results, errors); - total++; - if (total === objArrLength) { - callback(results); - } - }; - objArrKeys.forEach((key) => { - const arr = objArr[key]; - if (firstFields.indexOf(key) !== -1) { - asyncSerialArray(arr, func, next); - } else { - asyncParallelArray(arr, func, next); - } - }); -} - -export function complementError(rule) { - return (oe) => { - if (oe && oe.message) { - oe.field = oe.field || rule.fullField; - return oe; - } - return { - message: oe, - field: oe.field || rule.fullField, - }; - }; -} - -export function deepMerge(target, source) { - if (source) { - for (const s in source) { - if (source.hasOwnProperty(s)) { - const value = source[s]; - if (typeof value === 'object' && typeof target[s] === 'object') { - target[s] = { - ...target[s], - ...value, - }; - } else { - target[s] = value; - } - } - } - } - return target; -} diff --git a/dist/common/async-validator/validator/array.js b/dist/common/async-validator/validator/array.js deleted file mode 100755 index 5755124..0000000 --- a/dist/common/async-validator/validator/array.js +++ /dev/null @@ -1,29 +0,0 @@ -import rules from '../rule/index.js'; -import { isEmptyValue } from '../util'; -/** - * Validates an array. - * - * @param rule The validation rule. - * @param value The value of the field on the source object. - * @param callback The callback function. - * @param source The source object being validated. - * @param options The validation options. - * @param options.messages The validation messages. - */ -function array(rule, value, callback, source, options) { - const errors = []; - const validate = rule.required || (!rule.required && source.hasOwnProperty(rule.field)); - if (validate) { - if (isEmptyValue(value, 'array') && !rule.required) { - return callback(); - } - rules.required(rule, value, source, errors, options, 'array'); - if (!isEmptyValue(value, 'array')) { - rules.type(rule, value, source, errors, options); - rules.range(rule, value, source, errors, options); - } - } - callback(errors); -} - -export default array; diff --git a/dist/common/async-validator/validator/boolean.js b/dist/common/async-validator/validator/boolean.js deleted file mode 100755 index 74daa78..0000000 --- a/dist/common/async-validator/validator/boolean.js +++ /dev/null @@ -1,29 +0,0 @@ -import { isEmptyValue } from '../util'; -import rules from '../rule/index.js'; - -/** - * Validates a boolean. - * - * @param rule The validation rule. - * @param value The value of the field on the source object. - * @param callback The callback function. - * @param source The source object being validated. - * @param options The validation options. - * @param options.messages The validation messages. - */ -function boolean(rule, value, callback, source, options) { - const errors = []; - const validate = rule.required || (!rule.required && source.hasOwnProperty(rule.field)); - if (validate) { - if (isEmptyValue(value) && !rule.required) { - return callback(); - } - rules.required(rule, value, source, errors, options); - if (value !== undefined) { - rules.type(rule, value, source, errors, options); - } - } - callback(errors); -} - -export default boolean; diff --git a/dist/common/async-validator/validator/date.js b/dist/common/async-validator/validator/date.js deleted file mode 100755 index 9ac063a..0000000 --- a/dist/common/async-validator/validator/date.js +++ /dev/null @@ -1,32 +0,0 @@ -import rules from '../rule/index.js'; -import { isEmptyValue } from '../util'; - -function date(rule, value, callback, source, options) { - // console.log('integer rule called %j', rule); - const errors = []; - const validate = rule.required || (!rule.required && source.hasOwnProperty(rule.field)); - // console.log('validate on %s value', value); - if (validate) { - if (isEmptyValue(value) && !rule.required) { - return callback(); - } - rules.required(rule, value, source, errors, options); - if (!isEmptyValue(value)) { - let dateObject; - - if (typeof value === 'number') { - dateObject = new Date(value); - } else { - dateObject = value; - } - - rules.type(rule, dateObject, source, errors, options); - if (dateObject) { - rules.range(rule, dateObject.getTime(), source, errors, options); - } - } - } - callback(errors); -} - -export default date; diff --git a/dist/common/async-validator/validator/enum.js b/dist/common/async-validator/validator/enum.js deleted file mode 100755 index 20e1a2c..0000000 --- a/dist/common/async-validator/validator/enum.js +++ /dev/null @@ -1,30 +0,0 @@ -import rules from '../rule/index.js'; -import { isEmptyValue } from '../util'; -const ENUM = 'enum'; - -/** - * Validates an enumerable list. - * - * @param rule The validation rule. - * @param value The value of the field on the source object. - * @param callback The callback function. - * @param source The source object being validated. - * @param options The validation options. - * @param options.messages The validation messages. - */ -function enumerable(rule, value, callback, source, options) { - const errors = []; - const validate = rule.required || (!rule.required && source.hasOwnProperty(rule.field)); - if (validate) { - if (isEmptyValue(value) && !rule.required) { - return callback(); - } - rules.required(rule, value, source, errors, options); - if (value) { - rules[ENUM](rule, value, source, errors, options); - } - } - callback(errors); -} - -export default enumerable; diff --git a/dist/common/async-validator/validator/float.js b/dist/common/async-validator/validator/float.js deleted file mode 100755 index 13b4993..0000000 --- a/dist/common/async-validator/validator/float.js +++ /dev/null @@ -1,30 +0,0 @@ -import rules from '../rule/index.js'; -import { isEmptyValue } from '../util'; - -/** - * Validates a number is a floating point number. - * - * @param rule The validation rule. - * @param value The value of the field on the source object. - * @param callback The callback function. - * @param source The source object being validated. - * @param options The validation options. - * @param options.messages The validation messages. - */ -function floatFn(rule, value, callback, source, options) { - const errors = []; - const validate = rule.required || (!rule.required && source.hasOwnProperty(rule.field)); - if (validate) { - if (isEmptyValue(value) && !rule.required) { - return callback(); - } - rules.required(rule, value, source, errors, options); - if (value !== undefined) { - rules.type(rule, value, source, errors, options); - rules.range(rule, value, source, errors, options); - } - } - callback(errors); -} - -export default floatFn; diff --git a/dist/common/async-validator/validator/index.js b/dist/common/async-validator/validator/index.js deleted file mode 100755 index 148bca5..0000000 --- a/dist/common/async-validator/validator/index.js +++ /dev/null @@ -1,33 +0,0 @@ -import string from './string'; -import method from './method'; -import number from './number'; -import boolean from './boolean'; -import regexp from './regexp'; -import integer from './integer'; -import float from './float'; -import array from './array'; -import object from './object'; -import enumValidator from './enum'; -import pattern from './pattern'; -import date from './date'; -import required from './required'; -import type from './type'; - -export default { - string, - method, - number, - boolean, - regexp, - integer, - float, - array, - object, - enum: enumValidator, - pattern, - date, - url: type, - hex: type, - email: type, - required, -}; diff --git a/dist/common/async-validator/validator/integer.js b/dist/common/async-validator/validator/integer.js deleted file mode 100755 index 5444e30..0000000 --- a/dist/common/async-validator/validator/integer.js +++ /dev/null @@ -1,30 +0,0 @@ -import rules from '../rule/index.js'; -import { isEmptyValue } from '../util'; - -/** - * Validates a number is an integer. - * - * @param rule The validation rule. - * @param value The value of the field on the source object. - * @param callback The callback function. - * @param source The source object being validated. - * @param options The validation options. - * @param options.messages The validation messages. - */ -function integer(rule, value, callback, source, options) { - const errors = []; - const validate = rule.required || (!rule.required && source.hasOwnProperty(rule.field)); - if (validate) { - if (isEmptyValue(value) && !rule.required) { - return callback(); - } - rules.required(rule, value, source, errors, options); - if (value !== undefined) { - rules.type(rule, value, source, errors, options); - rules.range(rule, value, source, errors, options); - } - } - callback(errors); -} - -export default integer; diff --git a/dist/common/async-validator/validator/method.js b/dist/common/async-validator/validator/method.js deleted file mode 100755 index 9ef0cbe..0000000 --- a/dist/common/async-validator/validator/method.js +++ /dev/null @@ -1,29 +0,0 @@ -import rules from '../rule/index.js'; -import { isEmptyValue } from '../util'; - -/** - * Validates a function. - * - * @param rule The validation rule. - * @param value The value of the field on the source object. - * @param callback The callback function. - * @param source The source object being validated. - * @param options The validation options. - * @param options.messages The validation messages. - */ -function method(rule, value, callback, source, options) { - const errors = []; - const validate = rule.required || (!rule.required && source.hasOwnProperty(rule.field)); - if (validate) { - if (isEmptyValue(value) && !rule.required) { - return callback(); - } - rules.required(rule, value, source, errors, options); - if (value !== undefined) { - rules.type(rule, value, source, errors, options); - } - } - callback(errors); -} - -export default method; diff --git a/dist/common/async-validator/validator/number.js b/dist/common/async-validator/validator/number.js deleted file mode 100755 index c7b2a19..0000000 --- a/dist/common/async-validator/validator/number.js +++ /dev/null @@ -1,30 +0,0 @@ -import rules from '../rule/index.js'; -import { isEmptyValue } from '../util'; - -/** - * Validates a number. - * - * @param rule The validation rule. - * @param value The value of the field on the source object. - * @param callback The callback function. - * @param source The source object being validated. - * @param options The validation options. - * @param options.messages The validation messages. - */ -function number(rule, value, callback, source, options) { - const errors = []; - const validate = rule.required || (!rule.required && source.hasOwnProperty(rule.field)); - if (validate) { - if (isEmptyValue(value) && !rule.required) { - return callback(); - } - rules.required(rule, value, source, errors, options); - if (value !== undefined) { - rules.type(rule, value, source, errors, options); - rules.range(rule, value, source, errors, options); - } - } - callback(errors); -} - -export default number; diff --git a/dist/common/async-validator/validator/object.js b/dist/common/async-validator/validator/object.js deleted file mode 100755 index 93afef5..0000000 --- a/dist/common/async-validator/validator/object.js +++ /dev/null @@ -1,29 +0,0 @@ -import rules from '../rule/index.js'; -import { isEmptyValue } from '../util'; - -/** - * Validates an object. - * - * @param rule The validation rule. - * @param value The value of the field on the source object. - * @param callback The callback function. - * @param source The source object being validated. - * @param options The validation options. - * @param options.messages The validation messages. - */ -function object(rule, value, callback, source, options) { - const errors = []; - const validate = rule.required || (!rule.required && source.hasOwnProperty(rule.field)); - if (validate) { - if (isEmptyValue(value) && !rule.required) { - return callback(); - } - rules.required(rule, value, source, errors, options); - if (value !== undefined) { - rules.type(rule, value, source, errors, options); - } - } - callback(errors); -} - -export default object; diff --git a/dist/common/async-validator/validator/pattern.js b/dist/common/async-validator/validator/pattern.js deleted file mode 100755 index f1b980c..0000000 --- a/dist/common/async-validator/validator/pattern.js +++ /dev/null @@ -1,32 +0,0 @@ -import rules from '../rule/index.js'; -import { isEmptyValue } from '../util'; - -/** - * Validates a regular expression pattern. - * - * Performs validation when a rule only contains - * a pattern property but is not declared as a string type. - * - * @param rule The validation rule. - * @param value The value of the field on the source object. - * @param callback The callback function. - * @param source The source object being validated. - * @param options The validation options. - * @param options.messages The validation messages. - */ -function pattern(rule, value, callback, source, options) { - const errors = []; - const validate = rule.required || (!rule.required && source.hasOwnProperty(rule.field)); - if (validate) { - if (isEmptyValue(value, 'string') && !rule.required) { - return callback(); - } - rules.required(rule, value, source, errors, options); - if (!isEmptyValue(value, 'string')) { - rules.pattern(rule, value, source, errors, options); - } - } - callback(errors); -} - -export default pattern; diff --git a/dist/common/async-validator/validator/regexp.js b/dist/common/async-validator/validator/regexp.js deleted file mode 100755 index c68883b..0000000 --- a/dist/common/async-validator/validator/regexp.js +++ /dev/null @@ -1,29 +0,0 @@ -import rules from '../rule/index.js'; -import { isEmptyValue } from '../util'; - -/** - * Validates the regular expression type. - * - * @param rule The validation rule. - * @param value The value of the field on the source object. - * @param callback The callback function. - * @param source The source object being validated. - * @param options The validation options. - * @param options.messages The validation messages. - */ -function regexp(rule, value, callback, source, options) { - const errors = []; - const validate = rule.required || (!rule.required && source.hasOwnProperty(rule.field)); - if (validate) { - if (isEmptyValue(value) && !rule.required) { - return callback(); - } - rules.required(rule, value, source, errors, options); - if (!isEmptyValue(value)) { - rules.type(rule, value, source, errors, options); - } - } - callback(errors); -} - -export default regexp; diff --git a/dist/common/async-validator/validator/required.js b/dist/common/async-validator/validator/required.js deleted file mode 100755 index 00e6d01..0000000 --- a/dist/common/async-validator/validator/required.js +++ /dev/null @@ -1,10 +0,0 @@ -import rules from '../rule/index.js'; - -function required(rule, value, callback, source, options) { - const errors = []; - const type = Array.isArray(value) ? 'array' : typeof value; - rules.required(rule, value, source, errors, options, type); - callback(errors); -} - -export default required; diff --git a/dist/common/async-validator/validator/string.js b/dist/common/async-validator/validator/string.js deleted file mode 100755 index 411fee7..0000000 --- a/dist/common/async-validator/validator/string.js +++ /dev/null @@ -1,34 +0,0 @@ -import rules from '../rule/index.js'; -import { isEmptyValue } from '../util'; - -/** - * Performs validation for string types. - * - * @param rule The validation rule. - * @param value The value of the field on the source object. - * @param callback The callback function. - * @param source The source object being validated. - * @param options The validation options. - * @param options.messages The validation messages. - */ -function string(rule, value, callback, source, options) { - const errors = []; - const validate = rule.required || (!rule.required && source.hasOwnProperty(rule.field)); - if (validate) { - if (isEmptyValue(value, 'string') && !rule.required) { - return callback(); - } - rules.required(rule, value, source, errors, options, 'string'); - if (!isEmptyValue(value, 'string')) { - rules.type(rule, value, source, errors, options); - rules.range(rule, value, source, errors, options); - rules.pattern(rule, value, source, errors, options); - if (rule.whitespace === true) { - rules.whitespace(rule, value, source, errors, options); - } - } - } - callback(errors); -} - -export default string; diff --git a/dist/common/async-validator/validator/type.js b/dist/common/async-validator/validator/type.js deleted file mode 100755 index 79a05fa..0000000 --- a/dist/common/async-validator/validator/type.js +++ /dev/null @@ -1,20 +0,0 @@ -import rules from '../rule/index.js'; -import { isEmptyValue } from '../util'; - -function type(rule, value, callback, source, options) { - const ruleType = rule.type; - const errors = []; - const validate = rule.required || (!rule.required && source.hasOwnProperty(rule.field)); - if (validate) { - if (isEmptyValue(value, ruleType) && !rule.required) { - return callback(); - } - rules.required(rule, value, source, errors, options, ruleType); - if (!isEmptyValue(value, ruleType)) { - rules.type(rule, value, source, errors, options); - } - } - callback(errors); -} - -export default type; diff --git a/dist/common/select.js b/dist/common/select.js deleted file mode 100755 index 7f80c6f..0000000 --- a/dist/common/select.js +++ /dev/null @@ -1,33 +0,0 @@ -function getCtx(selector) { - const pages = getCurrentPages(); - const ctx = pages[pages.length - 1]; - - const componentCtx = ctx.selectComponent(selector); - - if (!componentCtx) { - console.error('无法找到对应的组件,请按文档说明使用组件'); - return null; - } - return componentCtx; -} - -// 调用showToast -function selectToast(options) { - const { selector = '#toast' } = options; - const ctx = getCtx(selector); - - ctx.handleShow(options); -} - -// 调用showMessage -function selectMessage(options) { - const { selector = '#message' } = options; - const ctx = getCtx(selector); - - ctx.handleShow(options); -} - -module.exports = { - $Toast: selectToast, - $Message: selectMessage -}; \ No newline at end of file diff --git a/dist/grid-item/index.js b/dist/grid-item/index.js deleted file mode 100755 index ff43aec..0000000 --- a/dist/grid-item/index.js +++ /dev/null @@ -1,30 +0,0 @@ -Component({ - relations: { - '../grid/index': { - type: 'parent' - }, - }, - externalClasses: ['l-grid-item'], - properties: { - key: String - }, - data: {}, - attached() { - - }, - - lifetimes: { - show() { - - }, - }, - methods: { - tapGridItem(e) { - this.triggerEvent('lintap', { - ...e - }, { - composed: true - }) - }, - } -}); \ No newline at end of file diff --git a/dist/grid-item/index.json b/dist/grid-item/index.json deleted file mode 100755 index e4ee9de..0000000 --- a/dist/grid-item/index.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "component": true, - "usingComponents": { - - } - } \ No newline at end of file diff --git a/dist/grid-item/index.wxml b/dist/grid-item/index.wxml deleted file mode 100755 index 40eb25f..0000000 --- a/dist/grid-item/index.wxml +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/dist/grid-item/index.wxss b/dist/grid-item/index.wxss deleted file mode 100755 index f7b1273..0000000 --- a/dist/grid-item/index.wxss +++ /dev/null @@ -1 +0,0 @@ -.grid-item{max-width:initial;max-height:initial;display:flex;justify-content:center;align-items:center;flex-direction:column} \ No newline at end of file diff --git a/dist/grid/index.js b/dist/grid/index.js deleted file mode 100755 index 7dd1f84..0000000 --- a/dist/grid/index.js +++ /dev/null @@ -1,76 +0,0 @@ -Component({ - options: { - multipleSlots: true // 在组件定义时的选项中启用多slot支持 - }, - relations: { - '../grid-item/index': { - type: 'child', - linked(target) { - this.initGrids(); - - }, - unlinked(target) { - this.initGrids(); - } - }, - - }, - externalClasses: ['l-class', 'l-class-grid'], - properties: { - rowNum: { - type: String, - value: 3, - }, - showBorder: Boolean, - showColBorder: Boolean, - showRowBorder: Boolean, - }, - data: { - gridItems: [], - childNum: 0, - currentIndex:null, - }, - ready() { - this.initGrids(); - }, - - lifetimes: { - show() { - - }, - }, - methods: { - initGrids() { - let items = this.getRelationNodes('../grid-item/index'); - if (this.data.childNum === items.length) return; - const gridItems = items.map((item) => { - return { - key: item.data.key - } - }); - this.setData({ - gridItems: gridItems, - childNum: items.length - }) - }, - - tapGridItem(e) { - const { - index - } = e.currentTarget.dataset; - this.setData({ - currentIndex:index - }); - let items = this.getRelationNodes('../grid-item/index'); - items[index].tapGridItem({ - index: index - }); - }, - - tapGrid(e) { - this.triggerEvent('lintap', { - index:this.data.currentIndex - }) - } - } -}); \ No newline at end of file diff --git a/dist/grid/index.json b/dist/grid/index.json deleted file mode 100755 index e4ee9de..0000000 --- a/dist/grid/index.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "component": true, - "usingComponents": { - - } - } \ No newline at end of file diff --git a/dist/grid/index.wxml b/dist/grid/index.wxml deleted file mode 100755 index 37cf452..0000000 --- a/dist/grid/index.wxml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/dist/grid/index.wxss b/dist/grid/index.wxss deleted file mode 100755 index a91bfeb..0000000 --- a/dist/grid/index.wxss +++ /dev/null @@ -1 +0,0 @@ -.l-grid{display:flex;width:inherit;flex-wrap:wrap;padding-top: 20rpx}.l-grid .l-grid-item{display:flex;justify-content:center;align-items:center;flex-direction:column;text-align:center;box-sizing:border-box;border-style:solid;border-color:#ededed;border-width:0}.l-grid .center-grid{border-bottom-width:2rpx}.l-grid .side-grid{border-right-width:2rpx} \ No newline at end of file diff --git a/dist/icon/index.js b/dist/icon/index.js deleted file mode 100755 index ba35df5..0000000 --- a/dist/icon/index.js +++ /dev/null @@ -1,35 +0,0 @@ -Component({ - externalClasses: ['l-class','l-class-self',], - options: { - addGlobalClass: true, - }, - properties: { - name: { - type: String, - value: '' - }, - color: { - type: String, - value: '', - }, - size: { - type: String, - value: '', - }, - }, - - data:{ - default:{ - size:40, - color:'#45526B', - }, - }, - - ready:function(){ - if(!this.data.name) { - console.error('请传入Icon组件的name属性'); - } - }, - methods: { - } -}); diff --git a/dist/icon/index.json b/dist/icon/index.json deleted file mode 100755 index 8bc8f18..0000000 --- a/dist/icon/index.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "component": true, - "usingComponents": { - - } - } \ No newline at end of file diff --git a/dist/icon/index.wxml b/dist/icon/index.wxml deleted file mode 100755 index d78e60c..0000000 --- a/dist/icon/index.wxml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/dist/icon/index.wxss b/dist/icon/index.wxss deleted file mode 100755 index 63ba57e..0000000 --- a/dist/icon/index.wxss +++ /dev/null @@ -1 +0,0 @@ -/*@font-face{font-family:iconfont;src:url('data:application/x-font-woff2;charset=utf-8;base64,d09GMgABAAAAABicAAsAAAAALSwAABhMAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHEIGVgCHbgrEILVkATYCJAOBPAtgAAQgBYRtB4M8G8gkRUaGjQNAIG1zEdWaLvv/ksCNoVINtb+E7URYlSBXILpVTQeLjoqbHJ+cOfYf4maEM/uA9haOGSSs3/uUE+JFWzyOOSQJTR74P/zdN/+aZ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Dbz3q+9CToY+Wr/7qxby/Xg0jetsJNC1hx9Ek7+++CoIh+fPdU+SWtdfeJXN/YV5rkOJQvP0fRGncH5dzqs/9RIOQWEav88ks+yy8+B/euaFW9l34DdF2xay/7lfEgC5hF3l5eEdfQTAk73w/PZ4it/zp9q727//CvNYgkNd8efw/iNL39452DgjaT9mQXnMsQb3OJxa42R9eLLx4PwIXdVdjr4NbvSHaTsGo9Ff74GgZVe76Ty/6Jkn6Xje6IvQZsODAQ8AMcyywxAprbLDFDvtiqVyp1uqNZqvd6fb6g+FoPJnO5ovlar3Z7vYHm9NKJfBwpQR2meUyhpQEqtM5xMstSHqutOViEBtiZcUYC+IFaRRivxY0c4lv7Utc1XiBbBVypYhNQoXBIZFN0ErlkCbhR1JX0iGHK8tIi3ce6Qpqf8YdYyECly13V5HNVbrgQ2OjTDEYcRtYEmQkEqQ2Tz2o3qqduIUFY6doq+Clr7VuqTUOQnOxieUVQWIZeuGGUWF2ZdBpDG3QEh58XWNkNYFTXpMzWvBs1DfGW0X2p7W7//SD3Kq9wkBlu7JqQR4eAAAA') format('woff2')}.l-icon{font-family:iconfonts!important;font-size:40rpx;color:#3963bc;font-style:normal;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.l-icon::before{display:inline-flex}.l-icon-finish:before{content:"\e63c"}.l-icon-mistake:before{content:"\e632"}.l-icon-video:before{content:"\e609"}.l-icon-address:before{content:"\e606"}.l-icon-backward:before{content:"\e607"}.l-icon-add:before{content:"\e608"}.l-icon-cart:before{content:"\e60a"}.l-icon-close:before{content:"\e60b"}.l-icon-checked:before{content:"\e60c"}.l-icon-comment:before,.l-icon-default:before{content:"\e60d"}.l-icon-down:before{content:"\e60e"}.l-icon-customer-service:before{content:"\e60f"}.l-icon-delete:before{content:"\e610"}.l-icon-edit:before{content:"\e611"}.l-icon-download:before{content:"\e612"}.l-icon-ellipsis:before{content:"\e613"}.l-icon-favor:before{content:"\e614"}.l-icon-forward:before{content:"\e615"}.l-icon-help:before{content:"\e616"}.l-icon-eye:before{content:"\e617"}.l-icon-history:before{content:"\e618"}.l-icon-left:before{content:"\e619"}.l-icon-like:before{content:"\e61a"}.l-icon-notification:before{content:"\e61b"}.l-icon-order:before{content:"\e61c"}.l-icon-loading:before{content:"\e61d"}.l-icon-password:before{content:"\e61e"}.l-icon-more:before{content:"\e61f"}.l-icon-picture:before{content:"\e620"}.l-icon-pull-down:before{content:"\e621"}.l-icon-right:before{content:"\e622"}.l-icon-research:before{content:"\e623"}.l-icon-phone:before{content:"\e624"}.l-icon-setting:before{content:"\e625"}.l-icon-scan:before{content:"\e626"}.l-icon-share:before{content:"\e627"}.l-icon-success:before{content:"\e628"}.l-icon-soud:before{content:"\e629"}.l-icon-time:before{content:"\e62a"}.l-icon-error:before{content:"\e62b"}.l-icon-to-top:before{content:"\e62c"}.l-icon-up:before{content:"\e62d"}.l-icon-WiFi:before{content:"\e62e"}.l-icon-user:before{content:"\e62f"}.l-icon-warning:before{content:"\e630"}.l-icon-favor-fill:before{content:"\e631"}*/ diff --git a/dist/image-picker/index.json b/dist/image-picker/index.json index af2d0be..9cc7a48 100755 --- a/dist/image-picker/index.json +++ b/dist/image-picker/index.json @@ -1,7 +1,6 @@ { "component": true, "usingComponents": { - "l-icon": "../icon/index", "l-grid-item": "../grid-item/index", "l-grid": "../grid/index" } diff --git a/dist/image-picker/index.wxml b/dist/image-picker/index.wxml index 91a0230..28bce58 100755 --- a/dist/image-picker/index.wxml +++ b/dist/image-picker/index.wxml @@ -8,7 +8,7 @@ slot="{{ index }}"> - + x diff --git a/dist/input/index.json b/dist/input/index.json index ff01f41..78013bd 100755 --- a/dist/input/index.json +++ b/dist/input/index.json @@ -1,6 +1,5 @@ { "component": true, "usingComponents": { - "l-icon": "../icon/index" } } \ No newline at end of file diff --git a/dist/input/index.wxss b/dist/input/index.wxss index 39a54b0..34a1857 100755 --- a/dist/input/index.wxss +++ b/dist/input/index.wxss @@ -1 +1,2 @@ -.form-item{position:relative;font-size:28rpx;color:#333;width:750rpx;height:88rpx;display:flex;flex-direction:row;align-items:center;padding-right:25rpx;box-sizing:border-box}.row{position:absolute;bottom:0;right:0;height:1rpx;width:730rpx;background:#f3f3f3}.text-require{color:#e23;vertical-align:middle}.form-label{font-size:28rpx;display:flex;flex-direction:row;align-items:center;height:88rpx;padding-left:25rpx;padding-right:15rpx;box-sizing:border-box}.disabled{color:#9a9a9a!important}.mask{position:absolute;z-index:999;height:100%;width:100%}.form-label-right{justify-content:flex-end}.form-label-left{justify-content:flex-start}.input{height:100%;line-height:100%;flex:1;font-size: 26rpx}.close{height:30rpx;width:30rpx;background:#ddd;display:flex;flex-direction:row;align-items:center;justify-content:center;border-radius:50%;margin-right:20rpx}.pls-class{color:#9a9a9a} \ No newline at end of file +.form-item{position:relative;font-size:28rpx;color:#333;width:750rpx;height:88rpx;display:flex; + border-bottom: 1px solid #f1f2f6;flex-direction:row;align-items:center;padding-right:25rpx;box-sizing:border-box}.row{position:absolute;bottom:0;right:0;height:1rpx;width:730rpx;background:#f3f3f3}.text-require{color:#e23;vertical-align:middle}.form-label{font-size:28rpx;display:flex;flex-direction:row;align-items:center;height:88rpx;padding-left:25rpx;padding-right:15rpx;box-sizing:border-box}.disabled{color:#9a9a9a!important}.mask{position:absolute;z-index:999;height:100%;width:100%}.form-label-right{justify-content:flex-end}.form-label-left{justify-content:flex-start}.input{height:100%;line-height:100%;flex:1;font-size: 26rpx}.close{height:30rpx;width:30rpx;background:#ddd;display:flex;flex-direction:row;align-items:center;justify-content:center;border-radius:50%;margin-right:20rpx}.pls-class{color:#9a9a9a} \ No newline at end of file diff --git a/dist/search-bar/index.json b/dist/search-bar/index.json index ccccaa9..c21c4ad 100755 --- a/dist/search-bar/index.json +++ b/dist/search-bar/index.json @@ -1,7 +1,6 @@ { "component": true, "usingComponents": { - "l-input": "../input/index", - "l-icon": "../icon/index" + "l-input": "../input/index" } } \ No newline at end of file diff --git a/dist/segment-item/index.wxss b/dist/segment-item/index.wxss deleted file mode 100644 index e69de29..0000000 diff --git a/dist/textarea/index.json b/dist/textarea/index.json index ff01f41..78013bd 100755 --- a/dist/textarea/index.json +++ b/dist/textarea/index.json @@ -1,6 +1,5 @@ { "component": true, "usingComponents": { - "l-icon": "../icon/index" } } \ No newline at end of file diff --git a/dist/water-flow/index.js b/dist/water-flow/index.js deleted file mode 100755 index 29648e4..0000000 --- a/dist/water-flow/index.js +++ /dev/null @@ -1,77 +0,0 @@ -// pages/components/water/index.js -Component({ - /** - * 组件的属性列表 - */ - properties: { - columnGap: { - type: String, - value: '20rpx' - } - }, - - /** - * 组件的初始数据 - */ - data: { - data: [], - leftData: [], - rightData: [] - }, - - attached() { - this._init() - }, - - /** - * 组件的方法列表 - */ - methods: { - _init() { - wx.lin = wx.lin || {}; - wx.lin.renderWaterFlow = (data = [], success) => { - if (Object.prototype.toString.call(data) !== '[object Array]') { - console.error("[data]参数类型错误,渲染失败"); - return false; - } - this._select(data).then(() => { - success && success() - }) - } - }, - _select(data) { - const query = wx.createSelectorQuery().in(this) - this.columnNodes = query.selectAll('#left, #right') - - return new Promise((resolve, reject) => { - this._render(data, 0, () => { - resolve() - }) - }) - }, - _render(data, i, success) { - if (data.length > i) { - this.columnNodes.boundingClientRect().exec(res => { - const rects = res[0] - const leftHeight = rects[0].height - const rightHeight = rects[1].height - - if (leftHeight <= rightHeight) { - this.data.leftData.push(data[i]) - } else { - this.data.rightData.push(data[i]) - } - - this.setData({ - leftData: this.data.leftData, - rightData: this.data.rightData - }, _ => { - this._render(data, ++i, success) - }) - }) - } else { - success && success() - } - } - } -}) diff --git a/dist/water-flow/index.json b/dist/water-flow/index.json deleted file mode 100755 index 5e96f35..0000000 --- a/dist/water-flow/index.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "component": true, - "usingComponents": {}, - "componentGenerics": { - "l-water-flow-item": true - } - } \ No newline at end of file diff --git a/dist/water-flow/index.wxml b/dist/water-flow/index.wxml deleted file mode 100755 index ba06433..0000000 --- a/dist/water-flow/index.wxml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/dist/water-flow/index.wxss b/dist/water-flow/index.wxss deleted file mode 100755 index 33e0b30..0000000 --- a/dist/water-flow/index.wxss +++ /dev/null @@ -1 +0,0 @@ -.water-flow-container{display:flex;width:100%;box-sizing:border-box}.water-column{flex:1} \ No newline at end of file diff --git a/image/empty-imgs/my-collect.png b/image/empty-imgs/my-collect.png deleted file mode 100644 index e956361..0000000 Binary files a/image/empty-imgs/my-collect.png and /dev/null differ diff --git a/image/empty-imgs/my-discuss.png b/image/empty-imgs/my-discuss.png deleted file mode 100644 index ab52680..0000000 Binary files a/image/empty-imgs/my-discuss.png and /dev/null differ diff --git a/image/empty-imgs/no-collect.png b/image/empty-imgs/no-collect.png new file mode 100644 index 0000000..5defbb6 Binary files /dev/null and b/image/empty-imgs/no-collect.png differ diff --git a/image/empty-imgs/no-comment.png b/image/empty-imgs/no-comment.png deleted file mode 100644 index 1c9b45f..0000000 Binary files a/image/empty-imgs/no-comment.png and /dev/null differ diff --git a/image/empty-imgs/no-house.png b/image/empty-imgs/no-house.png new file mode 100644 index 0000000..364ba81 Binary files /dev/null and b/image/empty-imgs/no-house.png differ diff --git a/image/empty-imgs/no-publish.png b/image/empty-imgs/no-publish.png new file mode 100644 index 0000000..7ee5d2b Binary files /dev/null and b/image/empty-imgs/no-publish.png differ diff --git a/image/empty-imgs/no-record.png b/image/empty-imgs/no-record.png deleted file mode 100644 index be8cadb..0000000 Binary files a/image/empty-imgs/no-record.png and /dev/null differ diff --git a/image/empty-imgs/none.png b/image/empty-imgs/none.png deleted file mode 100644 index bb2b8b8..0000000 Binary files a/image/empty-imgs/none.png and /dev/null differ diff --git a/image/empty-imgs/search_none.png b/image/empty-imgs/search_none.png deleted file mode 100644 index 2a025ad..0000000 Binary files a/image/empty-imgs/search_none.png and /dev/null differ diff --git a/image/empty-imgs/wait-submit.png b/image/empty-imgs/wait-submit.png deleted file mode 100644 index 3bd3996..0000000 Binary files a/image/empty-imgs/wait-submit.png and /dev/null differ diff --git a/image/icon/discuss.png b/image/icon/discuss.png deleted file mode 100644 index f1b9ed8..0000000 Binary files a/image/icon/discuss.png and /dev/null differ diff --git a/image/icon/location.png b/image/icon/location.png deleted file mode 100644 index b9e731e..0000000 Binary files a/image/icon/location.png and /dev/null differ diff --git a/pages/detail/detail.js b/pages/detail/detail.js index 35672fa..9c864b3 100755 --- a/pages/detail/detail.js +++ b/pages/detail/detail.js @@ -1,15 +1,14 @@ const app = getApp(); -const BASE = require('../../utils/basic'); Page({ data: { StatusBar: app.globalData.StatusBar, CustomBar: app.globalData.CustomBar, gridCol: 12, + favor_counts: 0, + collect_counts: 0, skin: false, - base:BASE.base.facilities, facilities: [], house: [], - nearby_houses:[], is_favor: false, is_collect: false, choose_time:"", @@ -116,13 +115,13 @@ Page({ }, HandleOperationDone(res){ var type = res.data.data; - var user_favors = this.data.user_favors; + var favor_counts = this.data.favor_counts; var collect_counts = this.data.collect_counts; if(type === 'favor'){ - user_favors += 1 + favor_counts += 1 } if(type === 'unfavor'){ - user_favors -= 1 + favor_counts -= 1 } if(type === 'collect'){ collect_counts +=1 @@ -131,7 +130,7 @@ Page({ collect_counts -=1 } this.setData({ - user_favors:user_favors, + favor_counts:favor_counts, collect_counts:collect_counts, }) }, @@ -215,31 +214,31 @@ Page({ }, HandleGetDone(res){ const that = this; - const facilities_list = []; var resp = res.data; if (resp.code === 200 ){ var house_data = resp.data; - for(var item in that.data.base){ - facilities_list.push({facilities:that.data.base[item],is_active: - (house_data.facilities.indexOf(item) !== -1)}) - } var house = house_data.house - house.create_time = app.handlePublishTimeDesc(new Date(), app.get_show_time(house.create_time)); + var facilities_conf = house_data.facilities_list; + for(let i=0;i< house.facilities.length;i++){ + facilities_conf[house.facilities[i]].is_active = true + } + console.log(facilities_conf) that.setData({ house_id:house.id, house: house, user_id: app.globalData.user_id, markers: [{ - iconPath: "/image/location.png", + iconPath: "/image/icon/location.png", latitude: house.latitude, longitude: house.longitude, }], - imglist:house_data.imgs, - user_favors:house_data.user_favors, - user_collects_avatar:house_data.user_collects_avatar, - facilities:facilities_list, + imglist:house.imgs, + user_favors:house.user_favors, + user_collects_avatar:house.user_collects_avatar, + facilities: facilities_conf, is_favor: house_data.is_favor, collect_counts: house_data.collect_counts, + favor_counts: house_data.favor_counts, is_collect: house_data.is_collect }); }else{ @@ -291,20 +290,7 @@ Page({ app.handlehouseClick(houseid) }, DetailOnload(options){ - let self = this; const house_id = options.house; - app.WxHttpRequestGet('house/periphery_house/'+ house_id,{},function (res) { - let houses = res.data.houses; - var curTime = new Date(); - if(houses){ - for(let i =0;i - {{user_favors}} + {{favor_counts}} @@ -110,7 +110,6 @@ {{house.desc}} - 可入住时间: {{house.checkin}} 周边地铁:{{house.subway}} @@ -132,16 +131,12 @@ - - - {{item.facilities.name}} + + + {{value.name}} - - - 周边房源 - diff --git a/pages/index/index.js b/pages/index/index.js index db138d9..8ee89ed 100755 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -31,8 +31,7 @@ Page({ data: { banners: [], icon_list: [], - feed_conf: {}, - tabList: [], + cards: [], show_empty:false, houses: [], publish_discuss:"right: 110rpx", @@ -81,55 +80,41 @@ Page({ } }, HandleIndexGetDone(res) { - var houses_result = res.data.house; - var curTime = new Date(); - var length = houses_result.length - for (var i = 0; i < length; i++) { - var house = houses_result[i]; - var publisher = house.publisher; - house.nickname = publisher.nickname; - house.avatarUrl = publisher.avatarUrl; - house.gender = publisher.gender=='2'?'cuIcon-female text-pink':'cuIcon-male text-blue'; - house.last_login = app.handlePublishTimeDesc(curTime, app.get_show_time(publisher.last_login)) - house.house_type = house_type[house.house_type]; - house.apartment = apartment[house.apartment]; - } - if(length > 0){ - this.setData({ - has_next: length > 0, - [`houses[${this.data.page}]`]: houses_result - }); - }else{ - this.setData({ - show_empty: true - }) + var resp = res.data; + if(resp.code === 200){ + var houses_result = resp.data.house; + var length = houses_result.length + if(length > 0){ + this.setData({ + has_next: length > 0, + [`houses[${this.data.page}]`]: houses_result + }); + }else{ + this.setData({ + show_empty: true + }) + } + } else { + app.ShowToast(resp.msg); } wx.hideLoading() }, LoadMoreDone(res) { - var page = this.data.page + 1; - var houses = res.data.house; - if (houses.length > 0) { - var curTime = new Date(); - for (let i = 0; i < houses.length; i++) { - var house = houses[i]; - var publisher = house.publisher; - house.nickname = publisher.nickname; - house.avatarUrl = publisher.avatarUrl; - house.gender = publisher.gender=='2'?'cuIcon-female text-pink':'cuIcon-male text-blue'; - house.last_login = app.handlePublishTimeDesc(curTime, app.get_show_time(publisher.last_login)) - house.house_type = house_type[house.house_type]; - house.apartment = apartment[house.apartment] + var resp = res.data; + if(resp.code === 200){ + var page = this.data.page + 1; + var houses = resp.data.house; + if (houses.length > 0) { + this.setData({ + [`houses[${page}]`]: houses, + page: page, + Loading: false + }) + } else { + this.setData({ + has_next: false + }) } - this.setData({ - [`houses[${page}]`]: houses, - page: page, - Loading: false - }) - } else { - this.setData({ - has_next: false - }) } wx.hideLoading() }, @@ -147,8 +132,8 @@ Page({ // 获取首页banner、icon、feed配置列表 let configs = res.data.data this.setData({ - banners: configs.banner, - feed_conf: configs.feed_setting, + banners: configs.banners, + cards: configs.cards, icon_list: configs.icons, }) }, diff --git a/pages/index/index.wxml b/pages/index/index.wxml index 9241b95..a3a75ec 100755 --- a/pages/index/index.wxml +++ b/pages/index/index.wxml @@ -12,23 +12,23 @@ - - - {{item.name}} + + + {{item.desc}} - - + - - + + @@ -51,12 +51,12 @@ {{item.title}} @@ -81,7 +81,6 @@ - - 等你来发布啦! + \ No newline at end of file diff --git a/pages/list/list.js b/pages/list/list.js index 781bd18..28dba01 100755 --- a/pages/list/list.js +++ b/pages/list/list.js @@ -71,10 +71,10 @@ Page({ }); this.GoToTop() if(input){ - app.WxHttpRequestGet('house/qq_search',{'title':input, + app.WxHttpRequestGet('house/search',{'title':input, 'city':city},this.SearchCallback); }else{ - app.WxHttpRequestGet('house/qq_search',{'city':city},this.SearchCallback, app.InterError); + app.WxHttpRequestGet('house/search',{'city':city},this.SearchCallback, app.InterError); } }, HandleSelectEvent: function(e) { @@ -115,7 +115,7 @@ Page({ houses:[] }); this.GoToTop() - app.WxHttpRequestGet('house/qq_search',conditions,this.SearchCallback, app.InterError); + app.WxHttpRequestGet('house/search',conditions,this.SearchCallback, app.InterError); }, GoToTop(e){ this.setData({ @@ -128,20 +128,6 @@ Page({ var houes_length = houses.length; var search_count = res.data.count; if(houes_length>0){ - var curTime = new Date(); - for (let i = 0; i < houes_length; i++) { - var house = houses[i]; - var publisher = house.publisher; - house.nickname = publisher.nickname; - house.avatarUrl = publisher.avatarUrl; - house.publisher_gender = publisher.gender=='2'?'cuIcon-female text-pink':'cuIcon-male text-blue'; - house.last_login = app.handlePublishTimeDesc(curTime, app.get_show_time(publisher.last_login)) - house.house_type = house_type[houses[i].house_type]; - house.apartment = apartment[houses[i].apartment]; - // this.setData({ - // [`houses[${this.data.page}][${i}]`]: houses - // }) - } this.setData({ has_next:true, house_count: search_count, @@ -201,7 +187,7 @@ Page({ houses:[] }); this.GoToTop() - app.WxHttpRequestGet('house/qq_search',conditions,this.SearchCallback, app.InterError); + app.WxHttpRequestGet('house/search',conditions,this.SearchCallback, app.InterError); }, /** * 生命周期函数--监听页面加载 @@ -214,7 +200,7 @@ Page({ res.data['regions'] = regions; that.setData({ regions: regions, - selects:res.data + selects: res.data }) }) }, @@ -236,7 +222,7 @@ Page({ conditions:condition }); app.wxshowloading('拼命加载中...'); - app.WxHttpRequestGet('house/qq_search',condition,that.SearchCallback); + app.WxHttpRequestGet('house/search',condition,that.SearchCallback); app.WxHttpRequestGet('house/selects',{'city':city},that.ParamsDone, app.InterError) }); }, @@ -301,7 +287,7 @@ Page({ app.wxshowloading('房源加载中'); var page = this.data.page; var condition = this.data.conditions - app.WxHttpRequestGet('house/qq_search?page='+page, condition, this.SearchCallback, app.InterError) + app.WxHttpRequestGet('house/search?page='+page, condition, this.SearchCallback, app.InterError) }else{ app.ShowToast('没有更多了...') } diff --git a/pages/list/list.json b/pages/list/list.json index d64f155..5d5cea5 100755 --- a/pages/list/list.json +++ b/pages/list/list.json @@ -1,6 +1,5 @@ { "usingComponents": { - "l-icon": "../../dist/icon/index", "select-form": "../../components/select-form/select-form" }, "disableScroll":true, diff --git a/pages/list/list.wxml b/pages/list/list.wxml index e6b82da..3764fcc 100755 --- a/pages/list/list.wxml +++ b/pages/list/list.wxml @@ -50,19 +50,19 @@ {{item.title}} - + {{item.house_type}} @@ -80,7 +80,7 @@ - + diff --git a/pages/my/my.js b/pages/my/my.js index 5d5cdcd..9cad8d7 100755 --- a/pages/my/my.js +++ b/pages/my/my.js @@ -64,6 +64,7 @@ Page({ } }, BindUserInfoDone(res) { + console.log(res) var that = this; var data = res.data; app.globalData.user_id = data.data.user_id; @@ -154,8 +155,9 @@ Page({ }, ShowAccount(data) { var that = this; + console.log(data) that.setData({ - gender: data.gender + gender: data.user.gender }) let i = 0; numDH(); @@ -185,8 +187,7 @@ Page({ wx.hideLoading() }, HanleAjaxItemDone(res) { - var data = res.data.data; - this.ShowAccount(data) + this.ShowAccount(res.data.data) }, /** * 页面上拉触底事件的处理函数 diff --git a/pages/mycollects/mycollects.js b/pages/mycollects/mycollects.js index fb9c1a7..a698432 100755 --- a/pages/mycollects/mycollects.js +++ b/pages/mycollects/mycollects.js @@ -1,14 +1,12 @@ // pages/mycollects/mycollects.js // 我的收藏 const app = getApp(); -const BASE = require('../../utils/basic'); Page({ /** * 页面的初始数据 */ data: { - apartment: BASE.base.apartment, }, /** @@ -40,15 +38,8 @@ Page({ }, GetPublishesDone(res){ - var curTime = new Date(); - var houses = res.data.data; - for(var i =0;i {{house.address}} - 收藏时间:{{house.create_time}} @@ -15,7 +14,7 @@ - {{apartment[house.apartment]}} + {{house.apartment}} {{house.title}} @@ -26,14 +25,14 @@ - + - {{house.author}} + {{house.publisher.nickname}} - - {{house.last_user_login}}来过 + + {{house.publisher.last_login}} @@ -46,7 +45,6 @@ - - 看到喜欢的房源,点击收藏~ + diff --git a/pages/mypublish/mypublish.js b/pages/mypublish/mypublish.js index dd5beed..9faefa3 100755 --- a/pages/mypublish/mypublish.js +++ b/pages/mypublish/mypublish.js @@ -1,13 +1,11 @@ // pages/mypublish/mypublish.js const app = getApp(); -const BASE = require('../../utils/basic'); Page({ /** * 页面的初始数据 */ data: { - apartment: BASE.base.apartment, }, HandleClick(res){ var houseid = res.currentTarget.dataset.houseId; @@ -62,7 +60,8 @@ Page({ if (res.confirm) { app.WxHttpRequestPOST('house/house_refresh', {houseid:houseid},function (res) { var data = res.data; - if(data.code == 200){ + console.log(data) + if(data.code === 200){ const index = e.currentTarget.dataset.index; that.data.houses[index].create_time = '刚刚刷新'; that.setData({ @@ -70,11 +69,7 @@ Page({ }) app.ShowToast('顶帖成功'); }else{ - if(data.data == 'just_fresh'){ - app.ShowModel('该房源刚刚刷新','请10分钟后再试'); - }else{ - that.showModal('DialogModal1') - } + app.ShowToast(data.msg); } }, app.InterError); } @@ -110,10 +105,6 @@ Page({ GetPublishesDone(res){ var curTime = new Date(); var houses = res.data.data; - for(var i =0;i - {{apartment[house.apartment]}} + {{house.apartment}} {{house.title}} @@ -71,6 +71,6 @@ - + diff --git a/pages/publish/publish.js b/pages/publish/publish.js index 79e3d33..ec23f6c 100755 --- a/pages/publish/publish.js +++ b/pages/publish/publish.js @@ -1,5 +1,4 @@ // pages/publish/publish.js -const BASE = require('../../utils/basic'); import WxValidate from '../../utils/WxValidate.js' const app = getApp(); Page({ @@ -14,23 +13,22 @@ Page({ area: "", desc: "", }, - - cur_house_type: "", address: "", - cur_rent_type: "", index: "", select_origin:false, - subway_list:[], - clear: false, - time: '12:01', - date: app.timestampToTime(Date.now()), subway: '', - apartment: BASE.base.apartment, - facilities: BASE.base.facilities, - house_type: BASE.base.house_type, urls: [], - timer: null, - have_subway: false + have_subway: false, + // 返回的可选择数据 + subway_list:[], + house_types:[], + apartments:[], + // 表单选择 name + choose_house_type: "", + choose_apartment: "", + // 表单选择的值 value + apartment: "", + house_type: "", }, AddressInput(e) { wx.getSetting({ @@ -68,39 +66,32 @@ Page({ } }) }, - TimeChange(e) { + HouseTypeChange(e) { + let choose = this.data.house_types[e.detail.value] + console.log(choose) this.setData({ - time: e.detail.value + choose_house_type: choose.name, + house_type: choose.value, }) }, - SubwayChange(e) { + ApartmentChange(e){ + let choose = this.data.apartments[e.detail.value] this.setData({ - subway: this.data.subway_list[e.detail.value] + choose_apartment: choose.name, + apartment: choose.value, }) }, - DateChange(e) { + SubwayChange(e) { this.setData({ - date: e.detail.value + subway: this.data.subway_list[e.detail.value] }) }, TagChoose(e) { - var key = e.target.dataset.key; - var facilities = this.data.facilities; - facilities[key].is_active = !facilities[key].is_active; - this.setData({ - facilities: facilities - }) - }, - houseType(e) { - var key = e.target.dataset.key; + var key = e.currentTarget.dataset.key; + var facility_list = this.data.facility_list; + facility_list[key].is_active = !facility_list[key].is_active; this.setData({ - cur_house_type: key - }) - }, - rentType(e) { - var key = e.target.dataset.key; - this.setData({ - cur_rent_type: key + facility_list: facility_list }) }, RegionChange: function (e) { @@ -114,22 +105,16 @@ Page({ app.WxHttpRequestGet('house/selects',data,this.ParamsDone) }, ParamsDone(res){ - var subway = res.data.subway - var subwaylist = []; - for(var s in subway){ - subwaylist.push(s) - } - if(subwaylist.length>0){ + let resp = res.data; + if(resp.code === 200){ this.setData({ - subway_list:subwaylist, - have_subway:true + subway_list: resp.data.subway, + apartments: resp.data.apartment, + house_types: resp.data.house_type, + facility_list: resp.data.facility_list, + have_subway: resp.data.subway.length > 0 }); - }else{ - this.setData({ - have_subway:false - }) } - wx.hideLoading() }, GetOssDone(res){ this.setData({ @@ -137,6 +122,12 @@ Page({ }) }, OssSign: function (e) { + let that = this; + app.WxHttpRequestGet('house/oss_sigin', {}, function (res) { + that.setData({ + oss: res.data.data + }) + }) }, fileupload: function (oss,filename, url) { return new Promise((resolve, reject) => { @@ -150,7 +141,7 @@ Page({ method: 'post', formData: { key: filename, - policy: oss.pocicy, + policy: oss.policy, OSSAccessKeyId: oss.accessKeyId, success_action_status: "200", signature: oss.sign, @@ -182,38 +173,37 @@ Page({ }, submitBtn: function (e) { var that = this; + var formId = e.detail.formId; + var wxdata = that.data; + const params = e.detail.value; + params['address'] = wxdata.address; + params['house_type'] = wxdata.house_type; + params['apartment'] = wxdata.apartment; + params['subway'] = wxdata.subway; + params['region'] = wxdata.region; + params['imgs'] = wxdata.urls; + params['latitude'] = wxdata.latitude; + params['longitude'] = wxdata.longitude; + if (!that.WxValidate.checkForm(params)) { + const error = that.WxValidate.errorList[0]; + that.showModal(error); + return false + } + var region_place = params['region'][2]; + if(!region_place){ + app.ShowModel('操作错误','请选择房源具体区域'); + return false + } wx.showModal({ title: '确认提示', content: '确认发布吗房源', success: function(res) { if(res.confirm){ - var formId = e.detail.formId; - var wxdata = that.data; - const params = e.detail.value; - params['house_type'] = wxdata.cur_rent_type; - params['address'] = wxdata.address; - params['apartment'] = wxdata.cur_house_type; - params['subway'] = wxdata.subway; - params['checkin'] = wxdata.date; - params['region'] = wxdata.region; - params['imgs'] = wxdata.urls; - params['latitude'] = wxdata.latitude; - params['longitude'] = wxdata.longitude; - if (!that.WxValidate.checkForm(params)) { - const error = that.WxValidate.errorList[0]; - that.showModal(error); - return false - } - var region_place = params['region'][2]; - if(!region_place){ - app.ShowModel('操作错误','请选择房源具体区域'); - return false - } app.wxshowloading('房源发布中...'); var tags = []; - var faci = wxdata.facilities; - for (var tag in faci) { - if (faci[tag].is_active) { + var facility_list_active = wxdata.facility_list; + for (var tag in facility_list_active) { + if (facility_list_active[tag].is_active) { tags.push(tag) } } @@ -250,12 +240,9 @@ Page({ address:"", subway:"", urls:[], - apartment: BASE.base.apartment, - facilities: BASE.base.facilities, - house_type: BASE.base.house_type }); setTimeout(function () { - wx.redirectTo({ + wx.switchTab({ url: '/pages/index/index' }) },2000) @@ -297,11 +284,13 @@ Page({ min: 1 }, storey: { + required: true, number: true, min: 1, max: 100 }, area: { + required: true, number: true, min: 1, max: 500 @@ -342,29 +331,29 @@ Page({ max: '房高得离谱,换个试试吧!', min: '楼层错误' }, - imgs: { - required: '请上传房源图片' - }, - address: { - required: '请选择详细地址' - }, area: { required: '请输入房源面积', number: '面积请输入整数', min: '面积输入错误,请重试~', max: '暂不支持>500平房源' }, + house_type: { + required: '请选择租房类型' + }, + apartment: { + required: '请选择户型' + }, + address: { + required: '请选择详细地址' + }, desc: { required: '请简要描述下你的房源', maxlength: '简介过长', minlength:'简介太短啦' }, - house_type: { - required: '请选择户型' + imgs: { + required: '请选择房源图片' }, - apartment: { - required: '请选择租房类型' - } } this.WxValidate = new WxValidate(rules, messages) }, @@ -383,7 +372,6 @@ Page({ * 生命周期函数--监听页面加载 */ onLoad: function (options) { - app.wxshowloading(''); this.setData({ region:[app.globalData.province,app.globalData.city,app.globalData.district] }) diff --git a/pages/publish/publish.wxml b/pages/publish/publish.wxml index a09d489..b6d3101 100755 --- a/pages/publish/publish.wxml +++ b/pages/publish/publish.wxml @@ -15,39 +15,22 @@ placeholder="详细的描述会给你带来快速转租~" /> - 户型 - - - {{item}} - - - - - 租房类型 - - - {{item}} + + 整租/合租 + + + {{choose_house_type?choose_house_type:'租房类型'}} - + - 可入住时间 - + 房型 + - {{date}} + {{choose_apartment?choose_apartment:'户型选择'}} - - 详细地址 - - - 房源区域 @@ -57,7 +40,7 @@ - 地铁 + 周边地铁 @@ -65,7 +48,14 @@ - + 详细地址 + + + + + 选择图片 + 添加丰富信息,出租更快捷 ~ - - - {{item.name}} + + + + + {{item.name}} diff --git a/pages/publish/publish.wxss b/pages/publish/publish.wxss index b727fac..88521cf 100755 --- a/pages/publish/publish.wxss +++ b/pages/publish/publish.wxss @@ -15,13 +15,10 @@ text-align: right; } .f-item{ - margin: 15rpx 15rpx 0 0; + margin: 10rpx; box-sizing: border-box; - border-radius: 30rpx; - padding: 10rpx 20rpx; -} -.f-item view{ - font-size: 24rpx; + border-radius: 10rpx; + padding: 5rpx; } .img { width: 100rpx; @@ -30,7 +27,6 @@ .title { font-size: 25rpx; padding: 20rpx 0; - color: #878787; } .add{ height: 100%; @@ -40,7 +36,13 @@ align-items: center; justify-content: center; } - +.facility_box { + display: flex; + display: -webkit-flex; + justify-content: space-between; + flex-direction: row; + flex-wrap: wrap; +} .add-icon { height: 50rpx; width: 50rpx; @@ -50,7 +52,6 @@ .add-text { margin-top: 6rpx; font-size: 24rpx; - font-weight: bold; color: #bfbfbf; } diff --git a/pages/userinfo/userinfo.wxml b/pages/userinfo/userinfo.wxml index 63740c5..0c64d1c 100644 --- a/pages/userinfo/userinfo.wxml +++ b/pages/userinfo/userinfo.wxml @@ -26,7 +26,6 @@ - {{gender=='1'?'男':'女'}}