flat: 合并, 报错修复

This commit is contained in:
Apcallover
2024-04-21 16:38:25 +08:00
parent 1d0ef39fff
commit 3cb42d7be1
4 changed files with 219 additions and 238 deletions

View File

@@ -372,7 +372,7 @@ const addressColumn = [
}, },
{ {
value: '185', value: '185',
label: "绵竹市" label: "广汉市"
}, },
{ {
value: '143', value: '143',

View File

@@ -414,8 +414,7 @@
} }
}, },
cityNamed() { cityNamed() {
console.log('val', this.info, this.area.dic) if (this.info && typeof this.info.cityId !== 'undefined' && this.info.cityId !== -1 && this.area.dic) {
if (this.info && this.info.cityId !== -1 && this.area.dic) {
return this.area.dic[this.info.cityId].label return this.area.dic[this.info.cityId].label
} else { } else {
return '无' return '无'

View File

@@ -1,234 +1,216 @@
<template> <template>
<view <view class="u-icon" @tap="clickHandler" :class="['u-icon--' + labelPos]">
class="u-icon" <image class="u-icon__img" v-if="isImg" :src="name" :mode="imgMode"
@tap="clickHandler" :style="[imgStyle, $u.addStyle(customStyle)]"></image>
:class="['u-icon--' + labelPos]" <text v-else class="u-icon__icon" :class="uClasses" :style="[iconStyle, $u.addStyle(customStyle)]"
> :hover-class="hoverClass">{{icon}}</text>
<image <!-- 这里进行空字符串判断如果仅仅是v-if="label"可能会出现传递0的时候结果也无法显示 -->
class="u-icon__img" <text v-if="label !== ''" class="u-icon__label" :style="{
v-if="isImg" color: labelColor,
:src="name" fontSize: $u.addUnit(labelSize),
:mode="imgMode" marginLeft: labelPos == 'right' ? $u.addUnit(space) : 0,
:style="[imgStyle, $u.addStyle(customStyle)]" marginTop: labelPos == 'bottom' ? $u.addUnit(space) : 0,
></image> marginRight: labelPos == 'left' ? $u.addUnit(space) : 0,
<text marginBottom: labelPos == 'top' ? $u.addUnit(space) : 0,
v-else }">{{ label }}</text>
class="u-icon__icon" </view>
:class="uClasses" </template>
:style="[iconStyle, $u.addStyle(customStyle)]"
:hover-class="hoverClass" <script>
>{{icon}}</text> // #ifdef APP-NVUE
<!-- 这里进行空字符串判断如果仅仅是v-if="label"可能会出现传递0的时候结果也无法显示 --> // nvue通过weex的dom模块引入字体相关文档地址如下
<text // https://weex.apache.org/zh/docs/modules/dom.html#addrule
v-if="label !== ''" const fontUrl = 'https://at.alicdn.com/t/font_2225171_8kdcwk4po24.ttf'
class="u-icon__label" const domModule = weex.requireModule('dom')
:style="{ domModule.addRule('fontFace', {
color: labelColor, 'fontFamily': "uicon-iconfont",
fontSize: $u.addUnit(labelSize), 'src': `url('${fontUrl}')`
marginLeft: labelPos == 'right' ? $u.addUnit(space) : 0, })
marginTop: labelPos == 'bottom' ? $u.addUnit(space) : 0, // #endif
marginRight: labelPos == 'left' ? $u.addUnit(space) : 0,
marginBottom: labelPos == 'top' ? $u.addUnit(space) : 0, // 引入图标名称已经对应的unicode
}" import icons from './icons'
>{{ label }}</text>
</view> import props from './props.js';;
</template>
/**
<script> * icon 图标
// #ifdef APP-NVUE * @description 基于字体的图标集,包含了大多数常见场景的图标。
// nvue通过weex的dom模块引入字体相关文档地址如下 * @tutorial https://www.uviewui.com/components/icon.html
// https://weex.apache.org/zh/docs/modules/dom.html#addrule * @property {String} name 图标名称,见示例图标集
const fontUrl = 'https://at.alicdn.com/t/font_2225171_8kdcwk4po24.ttf' * @property {String} color 图标颜色,可接受主题色 (默认 color['u-content-color']
const domModule = weex.requireModule('dom') * @property {String | Number} size 图标字体大小单位px (默认 '16px'
domModule.addRule('fontFace', { * @property {Boolean} bold 是否显示粗体 (默认 false
'fontFamily': "uicon-iconfont", * @property {String | Number} index 点击图标的时候传递事件出去的index用于区分点击了哪一个
'src': `url('${fontUrl}')` * @property {String} hoverClass 图标按下去的样式类用法同uni的view组件的hoverClass参数详情见官网
}) * @property {String} customPrefix 自定义扩展前缀,方便用户扩展自己的图标库 (默认 'uicon'
// #endif * @property {String | Number} label 图标右侧的label文字
* @property {String} labelPos label相对于图标的位置只能right或bottom (默认 'right'
// 引入图标名称已经对应的unicode * @property {String | Number} labelSize label字体大小单位px (默认 '15px'
import icons from './icons' * @property {String} labelColor 图标右侧的label文字颜色 默认 color['u-content-color']
* @property {String | Number} space label与图标的距离单位px (默认 '3px'
import props from './props.js';; * @property {String} imgMode 图片的mode
* @property {String | Number} width 显示图片小图标时的宽度
/** * @property {String | Number} height 显示图片小图标时的高度
* icon 图标 * @property {String | Number} top 图标在垂直方向上的定位 用于解决某些情况下,让图标垂直居中的用途 (默认 0
* @description 基于字体的图标集,包含了大多数常见场景的图标。 * @property {Boolean} stop 是否阻止事件传播 (默认 false
* @tutorial https://www.uviewui.com/components/icon.html * @property {Object} customStyle icon的样式对象形式
* @property {String} name 图标名称,见示例图标集 * @event {Function} click 点击图标时触发
* @property {String} color 图标颜色,可接受主题色 (默认 color['u-content-color'] * @event {Function} touchstart 事件触摸时触发
* @property {String | Number} size 图标字体大小单位px (默认 '16px' * @example <u-icon name="photo" color="#2979ff" size="28"></u-icon>
* @property {Boolean} bold 是否显示粗体 (默认 false */
* @property {String | Number} index 点击图标的时候传递事件出去的index用于区分点击了哪一个 export default {
* @property {String} hoverClass 图标按下去的样式类用法同uni的view组件的hoverClass参数详情见官网 name: 'u-icon',
* @property {String} customPrefix 自定义扩展前缀,方便用户扩展自己的图标库 (默认 'uicon' data() {
* @property {String | Number} label 图标右侧的label文字 return {
* @property {String} labelPos label相对于图标的位置只能right或bottom (默认 'right'
* @property {String | Number} labelSize label字体大小单位px (默认 '15px' }
* @property {String} labelColor 图标右侧的label文字颜色 默认 color['u-content-color'] },
* @property {String | Number} space label与图标的距离单位px (默认 '3px' mixins: [uni.$u.mpMixin, uni.$u.mixin, props],
* @property {String} imgMode 图片的mode computed: {
* @property {String | Number} width 显示图片小图标时的宽度 uClasses() {
* @property {String | Number} height 显示图片小图标时的高度 let classes = []
* @property {String | Number} top 图标在垂直方向上的定位 用于解决某些情况下,让图标垂直居中的用途 (默认 0 classes.push(this.customPrefix + '-' + this.name)
* @property {Boolean} stop 是否阻止事件传播 (默认 false // // uView的自定义图标类名为u-iconfont
* @property {Object} customStyle icon的样式对象形式 // if (this.customPrefix == 'uicon') {
* @event {Function} click 点击图标时触发 // classes.push('u-iconfont')
* @event {Function} touchstart 事件触摸时触发 // } else {
* @example <u-icon name="photo" color="#2979ff" size="28"></u-icon> // classes.push(this.customPrefix)
*/ // }
export default { // 主题色,通过类配置
name: 'u-icon', if (this.color && uni.$u.config.type.includes(this.color)) classes.push('u-icon__icon--' + this.color)
data() { // 阿里,头条,百度小程序通过数组绑定类名时,无法直接使用[a, b, c]的形式,否则无法识别
return { // 故需将其拆成一个字符串的形式,通过空格隔开各个类名
//#ifdef MP-ALIPAY || MP-TOUTIAO || MP-BAIDU
} classes = classes.join(' ')
}, //#endif
mixins: [uni.$u.mpMixin, uni.$u.mixin,props], return classes
computed: { },
uClasses() { iconStyle() {
let classes = [] let style = {}
classes.push(this.customPrefix + '-' + this.name) style = {
// // uView的自定义图标类名为u-iconfont fontSize: uni.$u.addUnit(this.size),
// if (this.customPrefix == 'uicon') { lineHeight: uni.$u.addUnit(this.size),
// classes.push('u-iconfont') fontWeight: this.bold ? 'bold' : 'normal',
// } else { // 某些特殊情况需要设置一个到顶部的距离,才能更好的垂直居中
// classes.push(this.customPrefix) top: uni.$u.addUnit(this.top)
// } }
// 主题色,通过类配置 // 主题色值时,才当作颜色值
if (this.color && uni.$u.config.type.includes(this.color)) classes.push('u-icon__icon--' + this.color) if (this.color && !uni.$u.config.type.includes(this.color)) style.color = this.color
// 阿里,头条,百度小程序通过数组绑定类名时,无法直接使用[a, b, c]的形式,否则无法识别
// 故需将其拆成一个字符串的形式,通过空格隔开各个类名 return style
//#ifdef MP-ALIPAY || MP-TOUTIAO || MP-BAIDU },
classes = classes.join(' ') // 判断传入的name属性是否图片路径只要带有"/"均认为是图片形式
//#endif isImg() {
return classes return this.name.indexOf('/') !== -1
}, },
iconStyle() { imgStyle() {
let style = {} let style = {}
style = { // 如果设置width和height属性则优先使用否则使用size属性
fontSize: uni.$u.addUnit(this.size), style.width = this.width ? uni.$u.addUnit(this.width) : uni.$u.addUnit(this.size)
lineHeight: uni.$u.addUnit(this.size), style.height = this.height ? uni.$u.addUnit(this.height) : uni.$u.addUnit(this.size)
fontWeight: this.bold ? 'bold' : 'normal', return style
// 某些特殊情况需要设置一个到顶部的距离,才能更好的垂直居中 },
top: uni.$u.addUnit(this.top) // 通过图标名,查找对应的图标
} icon() {
// 非主题色值时,才当作颜色值 // 如果内置的图标中找不到对应的图标就直接返回name值因为用户可能传入的是unicode代码
if (this.color && !uni.$u.config.type.includes(this.color)) style.color = this.color return icons['uicon-' + this.name] || this.name
}
return style },
}, methods: {
// 判断传入的name属性是否图片路径只要带有"/"均认为是图片形式 clickHandler(e) {
isImg() { this.$emit('click', this.index)
return this.name.indexOf('/') !== -1 // 是否阻止事件冒泡
}, this.stop && this.preventEvent(e)
imgStyle() { }
let style = {} }
// 如果设置width和height属性则优先使用否则使用size属性 }
style.width = this.width ? uni.$u.addUnit(this.width) : uni.$u.addUnit(this.size) </script>
style.height = this.height ? uni.$u.addUnit(this.height) : uni.$u.addUnit(this.size)
return style <style lang="scss" scoped>
}, @import "../../libs/css/components.scss";
// 通过图标名,查找对应的图标
icon() { // 变量定义
// 如果内置的图标中找不到对应的图标就直接返回name值因为用户可能传入的是unicode代码 $u-icon-primary: $u-primary !default;
return icons['uicon-' + this.name] || this.name $u-icon-success: $u-success !default;
} $u-icon-info: $u-info !default;
}, $u-icon-warning: $u-warning !default;
methods: { $u-icon-error: $u-error !default;
clickHandler(e) { $u-icon-label-line-height: 1 !default;
this.$emit('click', this.index)
// 是否阻止事件冒泡 /* #ifndef APP-NVUE */
this.stop && this.preventEvent(e) // 非nvue下加载字体
} @font-face {
} font-family: 'uicon-iconfont';
} src: url('/static/font/font_2225171_8kdcwk4po24.ttf') format('truetype');
</script> }
<style lang="scss" scoped> /* #endif */
@import "../../libs/css/components.scss";
.u-icon {
// 变量定义 /* #ifndef APP-NVUE */
$u-icon-primary: $u-primary !default; display: flex;
$u-icon-success: $u-success !default; /* #endif */
$u-icon-info: $u-info !default; align-items: center;
$u-icon-warning: $u-warning !default;
$u-icon-error: $u-error !default; &--left {
$u-icon-label-line-height:1 !default; flex-direction: row-reverse;
align-items: center;
/* #ifndef APP-NVUE */ }
// 非nvue下加载字体
@font-face { &--right {
font-family: 'uicon-iconfont'; flex-direction: row;
src: url('https://at.alicdn.com/t/font_2225171_8kdcwk4po24.ttf') format('truetype'); align-items: center;
} }
/* #endif */ &--top {
flex-direction: column-reverse;
.u-icon { justify-content: center;
/* #ifndef APP-NVUE */ }
display: flex;
/* #endif */ &--bottom {
align-items: center; flex-direction: column;
justify-content: center;
&--left { }
flex-direction: row-reverse;
align-items: center; &__icon {
} font-family: uicon-iconfont;
position: relative;
&--right { @include flex;
flex-direction: row; align-items: center;
align-items: center;
} &--primary {
color: $u-icon-primary;
&--top { }
flex-direction: column-reverse;
justify-content: center; &--success {
} color: $u-icon-success;
}
&--bottom {
flex-direction: column; &--error {
justify-content: center; color: $u-icon-error;
} }
&__icon { &--warning {
font-family: uicon-iconfont; color: $u-icon-warning;
position: relative; }
@include flex;
align-items: center; &--info {
color: $u-icon-info;
&--primary { }
color: $u-icon-primary; }
}
&__img {
&--success { /* #ifndef APP-NVUE */
color: $u-icon-success; height: auto;
} will-change: transform;
/* #endif */
&--error { }
color: $u-icon-error;
} &__label {
/* #ifndef APP-NVUE */
&--warning { line-height: $u-icon-label-line-height;
color: $u-icon-warning; /* #endif */
} }
}
&--info { </style>
color: $u-icon-info;
}
}
&__img {
/* #ifndef APP-NVUE */
height: auto;
will-change: transform;
/* #endif */
}
&__label {
/* #ifndef APP-NVUE */
line-height: $u-icon-label-line-height;
/* #endif */
}
}
</style>

View File

@@ -3,7 +3,7 @@ module.exports = {
port: 1887, port: 1887,
proxy: { proxy: {
'/api': { '/api': {
target: 'http://192.168.1.106:8000', target: 'http://10.165.0.173:8000',
ws: true, ws: true,
pathRewrite: { pathRewrite: {
'^/api': '/' '^/api': '/'