从 xghmall(云闪付版湘工游)迁移民票模块,改造为微信公众号 H5: - 技术栈沿用 uni-app + Vue2 + uView(含定制版日历组件) - 登录/支付独立成层(common/auth.js、common/pay.js): 一期假登录(测试手机号)+ 模拟支付,后端微信接口就绪后只换这两处 - 登录页重写:短信验证码 + 公众号网页授权(code 换用户信息)预留 - 门票列表页为入口页(进页必须登录),加订单悬浮按钮 - 支付成功页接通:查看订单/继续逛逛 + 订单状态轮询 - 详情页定位导航改用 uni.openLocation + 高德网页兜底 - 出行人页:身份证 18 位格式校验,删除死的删除按钮,修正证件类型回显笔误 - 清理云闪付 SDK、支付宝授权、死页面引用等残留 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
157 lines
3.2 KiB
Vue
157 lines
3.2 KiB
Vue
<template>
|
|
<view class="u-col" :class="[
|
|
'u-col-' + span
|
|
]" :style="{
|
|
padding: `0 ${Number(gutter)/2 + 'rpx'}`,
|
|
marginLeft: 100 / 12 * offset + '%',
|
|
flex: `0 0 ${100 / 12 * span}%`,
|
|
alignItems: uAlignItem,
|
|
justifyContent: uJustify,
|
|
textAlign: textAlign
|
|
}"
|
|
@tap="click">
|
|
<slot></slot>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
/**
|
|
* col 布局单元格
|
|
* @description 通过基础的 12 分栏,迅速简便地创建布局(搭配<u-row>使用)
|
|
* @tutorial https://www.uviewui.com/components/layout.html
|
|
* @property {String Number} span 栅格占据的列数,总12等分(默认0)
|
|
* @property {String} text-align 文字水平对齐方式(默认left)
|
|
* @property {String Number} offset 分栏左边偏移,计算方式与span相同(默认0)
|
|
* @example <u-col span="3"><view class="demo-layout bg-purple"></view></u-col>
|
|
*/
|
|
export default {
|
|
name: "u-col",
|
|
props: {
|
|
// 占父容器宽度的多少等分,总分为12份
|
|
span: {
|
|
type: [Number, String],
|
|
default: 12
|
|
},
|
|
// 指定栅格左侧的间隔数(总12栏)
|
|
offset: {
|
|
type: [Number, String],
|
|
default: 0
|
|
},
|
|
// 水平排列方式,可选值为`start`(或`flex-start`)、`end`(或`flex-end`)、`center`、`around`(或`space-around`)、`between`(或`space-between`)
|
|
justify: {
|
|
type: String,
|
|
default: 'start'
|
|
},
|
|
// 垂直对齐方式,可选值为top、center、bottom
|
|
align: {
|
|
type: String,
|
|
default: 'center'
|
|
},
|
|
// 文字对齐方式
|
|
textAlign: {
|
|
type: String,
|
|
default: 'left'
|
|
},
|
|
// 是否阻止事件传播
|
|
stop: {
|
|
type: Boolean,
|
|
default: true
|
|
}
|
|
},
|
|
data() {
|
|
return {
|
|
gutter: 20, // 给col添加间距,左右边距各占一半,从父组件u-row获取
|
|
}
|
|
},
|
|
created() {
|
|
this.parent = false;
|
|
},
|
|
mounted() {
|
|
// 获取父组件实例,并赋值给对应的参数
|
|
this.parent = this.$u.$parent.call(this, 'u-row');
|
|
if (this.parent) {
|
|
this.gutter = this.parent.gutter;
|
|
}
|
|
},
|
|
computed: {
|
|
uJustify() {
|
|
if (this.justify == 'end' || this.justify == 'start') return 'flex-' + this.justify;
|
|
else if (this.justify == 'around' || this.justify == 'between') return 'space-' + this.justify;
|
|
else return this.justify;
|
|
},
|
|
uAlignItem() {
|
|
if (this.align == 'top') return 'flex-start';
|
|
if (this.align == 'bottom') return 'flex-end';
|
|
else return this.align;
|
|
}
|
|
},
|
|
methods: {
|
|
click(e) {
|
|
this.$emit('click');
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss">
|
|
@import "../../libs/css/style.components.scss";
|
|
|
|
.u-col {
|
|
/* #ifdef MP-WEIXIN || MP-QQ || MP-TOUTIAO */
|
|
float: left;
|
|
/* #endif */
|
|
}
|
|
|
|
.u-col-0 {
|
|
width: 0;
|
|
}
|
|
|
|
.u-col-1 {
|
|
width: calc(100%/12);
|
|
}
|
|
|
|
.u-col-2 {
|
|
width: calc(100%/12 * 2);
|
|
}
|
|
|
|
.u-col-3 {
|
|
width: calc(100%/12 * 3);
|
|
}
|
|
|
|
.u-col-4 {
|
|
width: calc(100%/12 * 4);
|
|
}
|
|
|
|
.u-col-5 {
|
|
width: calc(100%/12 * 5);
|
|
}
|
|
|
|
.u-col-6 {
|
|
width: calc(100%/12 * 6);
|
|
}
|
|
|
|
.u-col-7 {
|
|
width: calc(100%/12 * 7);
|
|
}
|
|
|
|
.u-col-8 {
|
|
width: calc(100%/12 * 8);
|
|
}
|
|
|
|
.u-col-9 {
|
|
width: calc(100%/12 * 9);
|
|
}
|
|
|
|
.u-col-10 {
|
|
width: calc(100%/12 * 10);
|
|
}
|
|
|
|
.u-col-11 {
|
|
width: calc(100%/12 * 11);
|
|
}
|
|
|
|
.u-col-12 {
|
|
width: calc(100%/12 * 12);
|
|
}
|
|
</style>
|