Commit 4273bf12 authored by lizhan's avatar lizhan

📝 【TASK-20240815-01】TASK:接口联调

兑现详情、兑换日志、兑换礼品、积分页礼品列表、活动列表、活动详情、邮寄订单 接口联调
parent 0b22565d
......@@ -3,36 +3,41 @@
<dHeader :title="'活动详情'"></dHeader>
<view class="container">
<view class="img-box">
<image class="img" src="../../static/img/company.png"></image>
<image
class="img"
:src="locale === 'zh' ? detail.coverImageZh : detail.coverImageEn"
></image>
</view>
<view class="container-main">
<view class="activity-title">转发领优惠</view>
<view class="activity-remark"
>活动时间:2020-12-12 12:12:12活动时间:2020-12-12 12:12:12活动时间:2020-12-12
12:12:12活动时间:2020-12-12 12:12:12活动时间:2020-12-12 12:12:12活动时间:2020-12-12
12:12:12活动时间:2020-12-12 12:12:12活动时间:2020-12-12 12:12:12</view
>
<view class="activity-title">{{ locale === 'zh' ? detail.titleZh : detail.titleEn }}</view>
<view class="activity-remark" v-if="detail.extraRecommend">
{{
locale === 'zh'
? detail.extraRecommend.shareContentZh
: detail.extraRecommend.shareContentEn
}}
</view>
<view class="activity-cell">
<view class="cell-label">积分说明</view>
<view class="cell-content">
<image class="cell-image" src="../../static/img/score_b.png"></image>
<view class="cell-text">10</view>
<view class="cell-text">{{ detail.getScoreOnce }}</view>
</view>
</view>
<view class="activity-cell">
<view class="cell-label">累计最高积分</view>
<view class="cell-content">
<image class="cell-image" src="../../static/img/score_b.png"></image>
<view class="cell-text">100</view>
<view class="cell-text">{{ detail.maxScoreTotal }}</view>
</view>
</view>
<view class="activity-cell">
<view class="cell-label">有效期</view>
<view class="cell-content"> 2024-12-12 12:12:12 </view>
<view class="cell-content"> {{ getTimeRange(detail.startTime, detail.endTime) }} </view>
</view>
<view class="activity-cell">
<view class="cell-label">规则说明</view>
<view class="cell-content"> 每转发并邀请1人成功注册并登录获得10积久300 </view>
<view class="cell-content"> {{ locale === 'zh' ? detail.descZh : detail.descEn }} </view>
</view>
</view>
</view>
......@@ -44,6 +49,48 @@ import dHeader from '../../components/dHeader/index.vue'
export default {
components: {
dHeader
},
data() {
return {
id: null,
detail: {}
}
},
onLoad(route) {
console.log(route)
this.id = route.id
this.getDetail()
},
computed: {
locale() {
return this.$lang.locale
}
},
methods: {
// 获取详情
getDetail() {
this.$request
.post('/app-api/member/score-rule/get', { id: this.id })
.then(({ code, data }) => {
if (code === 0 && data) {
this.detail = data
}
})
},
// 时间范围返回
getTimeRange(start, end) {
const formatDate = (timestamp) => {
const date = new Date(timestamp)
const year = date.getFullYear()
const month = String(date.getMonth() + 1).padStart(2, '0')
const day = String(date.getDate()).padStart(2, '0')
const hours = String(date.getHours()).padStart(2, '0')
const minutes = String(date.getMinutes()).padStart(2, '0')
const seconds = String(date.getSeconds()).padStart(2, '0')
return `${year}:${month}:${day} ${hours}:${minutes}:${seconds}`
}
return `${formatDate(start)}${formatDate(end)}`
}
}
}
</script>
......
......@@ -7,65 +7,73 @@
<image class="img" src="../../static/img/exchange.png"></image>
</div>
<div class="header-content">
<div class="header-content-title">兑换完成</div>
<div class="header-content-title">
{{ locale === 'zh' ? detail.statusZh : detail.statusEn }}
</div>
<div class="header-content-text">
<view class="header-content-small">共计</view>90积分
<view class="header-content-small">共计</view>{{ detail.totalCount }}积分
</div>
</div>
</div>
<div class="nav">
<div class="nav-image">
<image class="img" src="../../static/img/exchange.png"></image>
<image class="img" :src="locale === 'zh' ? detail.imgZh : detail.imgEn"></image>
</div>
<div class="nav-content">
<div class="nav-content-text">小米官旗米家体脂秤S400智能精准减肥电子称</div>
<div class="nav-content-text">
{{ locale === 'zh' ? detail.rewardTitleZh : detail.rewardTitleEn }}
</div>
<div class="nav-content-tag">
<div class="tag-image">
<image class="img" src="../../static/img/score_b.png"></image>10
<image class="img" src="../../static/img/score_b.png"></image
>{{ detail.oncePointsRequire }}
</div>
<view class="tag-text">9</view>
<view class="tag-text">{{ detail.rewardCount }}</view>
</div>
</div>
</div>
<div class="main">
<div class="main-cell">
<div class="cell-label">活动时间</div>
<div class="cell-content">2023-10-1至2024-11-01</div>
<div class="cell-content">{{ getTimeRange(detail.startTime, detail.endTime) }}</div>
</div>
<div class="main-cell">
<div class="cell-label">活动网点</div>
<div class="cell-content">中国大连中央大道店黄河路50号</div>
</div>
<div class="main-cell">
<div class="cell-label">兑换方式</div>
<div class="cell-content">邮寄到家</div>
<div class="cell-content">
{{ locale === 'zh' ? detail.nodeTitleZh : detail.nodeTitleEn }}
</div>
</div>
<div class="main-cell">
<div class="cell-label">兑换方式</div>
<div class="cell-content">邮寄到家</div>
</div>
<div class="main-cell">
<div class="cell-label">收货地址</div>
<div class="cell-content">
孟佳程,+23583273669137中国 大连 中央大道黄河路50号
<view class="red">地址提交后无法修改,如需修改地址请联系客服</view>
{{ locale === 'zh' ? detail.redeemTypeZh : detail.redeemTypeEn }}
</div>
</div>
<div class="main-cell">
<div class="cell-label">快递单号</div>
<div class="cell-content">SFSF88997261500218</div>
</div>
<div class="main-cell">
<div class="cell-label">快递公司</div>
<div class="cell-content">顺丰快递</div>
</div>
<div class="main-cell">
<div class="cell-label">快递日期</div>
<div class="cell-content">2024-01-01</div>
</div>
<template v-if="detail.redeemType != 1">
<div class="main-cell">
<div class="cell-label">收货地址</div>
<div class="cell-content">
{{ detail.recipientName }}&ensp;+{{ detail.recipientPhoneNum }},
{{ detail.recipientAddress }}
<view class="red">地址提交后无法修改,如需修改地址请联系客服</view>
</div>
</div>
<div class="main-cell">
<div class="cell-label">快递单号</div>
<div class="cell-content">{{ detail.expressNo }}</div>
</div>
<div class="main-cell">
<div class="cell-label">快递公司</div>
<div class="cell-content">{{ detail.courierCompanyName }}</div>
</div>
<div class="main-cell">
<div class="cell-label">快递日期</div>
<div class="cell-content">{{ formatDate(detail.expressDate) }}</div>
</div>
</template>
<div class="main-cell">
<div class="cell-label">备注</div>
<div class="cell-content">请尽快发货</div>
<div class="cell-content">{{ detail.remark }}</div>
</div>
</div>
</div>
......@@ -77,6 +85,55 @@ import dHeader from '../../components/dHeader/index.vue'
export default {
components: {
dHeader
},
data() {
return {
id: null,
detail: {}
}
},
onLoad(route) {
console.log(route)
this.id = route.id
this.getDetail()
},
computed: {
locale() {
return this.$lang.locale
}
},
methods: {
// 获取详情
getDetail() {
this.$request
.post('/app-api/reward/redeem/record/detail', {
redeemId: this.id
})
.then(({ code, data }) => {
if (code == 0 && data) {
this.detail = data
}
})
.catch((error) => {
console.log(error)
})
},
// 时间范围返回
getTimeRange(start, end) {
return `${this.formatDate(start)}${this.formatDate(end)}`
},
// 时间戳转换为YYYY-MM-DD HH:mm:ss
formatDate(timestamp) {
if (!timestamp) return ''
const date = new Date(timestamp)
const year = date.getFullYear()
const month = String(date.getMonth() + 1).padStart(2, '0')
const day = String(date.getDate()).padStart(2, '0')
const hours = String(date.getHours()).padStart(2, '0')
const minutes = String(date.getMinutes()).padStart(2, '0')
const seconds = String(date.getSeconds()).padStart(2, '0')
return `${year}:${month}:${day} ${hours}:${minutes}:${seconds}`
}
}
}
</script>
......@@ -164,8 +221,8 @@ page {
color: var(--cb7b);
}
.nav-content-tag {
margin-top: auto;
width: 100%;
margin-top: 20upx;
display: flex;
align-items: center;
justify-content: space-between;
......
......@@ -3,37 +3,46 @@
<view class="gift-remark">不同网点兑换积分不同</view>
<view class="gift-select">
<view class="select-list">
<view class="list-item"
>{{ locale == 'zh' ? userInfo.countryTitleZh : userInfo.countryTitleEn }}
<uni-icons class="list-icon" type="right" color="#B3B3B3" size="12"></uni-icons>
</view>
<view class="list-item"
>{{ locale == 'zh' ? userInfo.cityTitleZh : userInfo.cityTitleEn }}
<view class="list-item" v-for="(item, index) in netList" :key="index"
>{{ item }}
<uni-icons class="list-icon" type="right" color="#B3B3B3" size="12"></uni-icons>
</view>
</view>
<view class="select-right">
请选择网点
<uni-icons class="list-icon" type="right" color="#B3B3B3" size="12"></uni-icons>
<picker
mode="multiSelector"
:range="pickerData"
:value="pickerValue"
:range-key="locale === 'zh' ? 'labelZh' : 'labelEn'"
@change="bindPickerChange"
@columnchange="bindColumnChange"
>
请选择网点
<uni-icons class="list-icon" type="right" color="#B3B3B3" size="12"></uni-icons>
</picker>
</view>
</view>
<view class="gift-content">
<view class="gift-item" v-for="item in 7" :key="item" @click="toMail">
<view class="gift-item" v-for="item in giftList" :key="item.id" @click="toMail(item.id)">
<view class="gift-image-box">
<image class="gift-image" mode="cover" src="../../../static/img/wallet.png"></image>
<image
class="gift-image"
mode="cover"
:src="locale == 'zh' ? item.imgZh : item.imgEn"
></image>
<view class="gift-tag">
<view class="tags">
<image class="tag-image" src="../../../static/img/score.png"></image>
<view class="tag-text">{{ item }}</view>
<view class="tag-text">{{ item.pointsRequire }}</view>
</view>
</view>
<view class="foot-tag">剩余99</view>
<view class="foot-tag">剩余{{ item.quantityRemain }}</view>
</view>
<view class="gift-name">商品名称</view>
<view class="gift-name">{{ locale === 'zh' ? item.titleZh : item.titleEn }}</view>
<view class="gift-menu">
<view class="gift-menu-text">包邮</view>
<view class="gift-menu-text">到付</view>
<view class="gift-menu-text">自提</view>
<view class="gift-menu-text" v-for="ele in item.pickMethodList" :key="ele.id">{{
locale === 'zh' ? ele.labelZh : ele.labelEn
}}</view>
</view>
</view>
</view>
......@@ -49,18 +58,122 @@ export default {
}
},
data() {
return {}
return {
giftList: [],
data: [],
pickerData: [[], [], []],
pickerValue: [0, 0, 0],
nodeId: null,
netList: []
}
},
computed: {
locale() {
return this.$lang.locale == 'zh' ? 'zh' : 'en'
return this.$lang.locale
}
},
watch: {
userInfo: {
handler(val) {
console.log(val)
this.netList =
this.$lang.locale === 'zh'
? [val.countryTitleZh, val.cityTitleZh]
: [val.countryTitleEn, val.cityTitleEn]
},
immediate: true
}
},
created() {
this.getGift()
this.getNet()
},
methods: {
toMail() {
toMail(id) {
uni.navigateTo({
url: '/pages/order_mail/order_mail'
url: '/pages/order_mail/order_mail?id=' + id
})
},
// 获取礼品列表
async getGift() {
try {
const memberId = this.$store.getters.id
const { code, data } = await this.$request.post('/app-api/ecw/reward/list', {
memberId,
nodeId: this.nodeId
})
if (code === 0) {
this.giftList = data
}
} catch (error) {
console.log(error)
}
},
// 获取网点列表
async getNet() {
try {
const { code, data } = await this.$request.get('/admin-api/ecw/node/get-node-tree-region')
if (code === 0) {
this.data = data
this.initPickerData()
}
} catch (error) {
console.log(error)
}
},
// 初始化选择器数据
initPickerData() {
if (this.data.length === 0) return
const countries = this.data
const cities = this.data[0].children || []
const areas = (this.data[0].children && this.data[0].children[0].children) || []
this.pickerData[0] = countries
this.pickerData[1] = cities
this.pickerData[2] = areas
},
// 选择改变
bindPickerChange(e) {
const val = e.detail.value
this.pickerValue = val
this.nodeId = this.pickerData[2][val[2]].id
this.getGift()
this.getPickerValue(val)
},
// 列改变
bindColumnChange(e) {
const { column, value } = e.detail
const data = {
pickerData: this.pickerData,
pickerValue: this.pickerValue
}
data.pickerValue[column] = value
if (column === 0) {
const selectedCountry = this.data[value]
const cities = selectedCountry.children || []
const areas = (cities[0] && cities[0].children) || []
data.pickerData[1] = cities
data.pickerData[2] = areas
data.pickerValue[1] = 0
data.pickerValue[2] = 0
} else if (column === 1) {
const selectedCountry = this.data[data.pickerValue[0]]
const selectedCity = selectedCountry.children[value]
const areas = selectedCity.children || []
data.pickerData[2] = areas
data.pickerValue[2] = 0
}
this.pickerData = data.pickerData
this.pickerValue = data.pickerValue
},
// 选择数据显示
getPickerValue(val) {
const countries = this.pickerData[0][val[0]]
const cities = this.pickerData[1][val[1]]
const areas = this.pickerData[2][val[2]]
this.netList =
this.locale === 'zh'
? [countries.labelZh, cities.labelZh, areas.labelZh]
: [countries.labelEn, cities.labelEn, areas.labelEn]
}
}
}
......@@ -150,8 +263,11 @@ export default {
align-items: center;
}
.gift-menu {
margin-bottom: 20upx;
display: flex;
height: 58upx;
gap: 10upx;
flex-wrap: wrap;
min-height: 58upx;
font-size: 20upx;
color: #b3b3b3;
align-items: center;
......@@ -178,8 +294,10 @@ export default {
display: flex;
align-items: center;
justify-content: center;
width: 80upx;
padding: 0 8upx;
min-width: 80upx;
height: 32upx;
box-sizing: border-box;
background: linear-gradient(#ef7e1a, #f1b009);
transform: skewX(15deg);
border-top-right-radius: 10upx;
......
<template>
<view class="int">
<view class="int-content" v-for="item in 6" :key="item" @click="toDetail">
<view
class="int-content"
v-for="item in activityList"
:key="item.id"
@click="toDetail(item.id)"
>
<view class="int-content-left">
<view class="content-tag">
<view class="tag-text">APP注册</view>
<view class="tag-text">{{ locale === 'zh' ? item.typeZh : item.typeEn }}</view>
</view>
<image class="content-image" src="../../../static/img/company.png"></image>
<image
class="content-image"
:src="locale === 'zh' ? item.coverImageZh : item.coverImageEn"
></image>
</view>
<view class="int-content-right">
<view class="content-title">此处是活动标题</view>
<view class="content-text"
>此处是活动内容,此处是活动内容,此处是活动内容,此处是活动内容,此处是活动内容,此处是活动内容,此处是活动内容,</view
>
<view class="content-title">{{ locale === 'zh' ? item.titleZh : item.titleEn }}</view>
<view class="content-text">{{ locale === 'zh' ? item.descZh : item.descEn }}</view>
</view>
</view>
</view>
......@@ -19,11 +25,35 @@
<script>
export default {
data() {
return {
activityList: []
}
},
created() {
this.getActivityList()
},
computed: {
locale() {
return this.$lang.locale
}
},
methods: {
toDetail() {
toDetail(id) {
uni.navigateTo({
url: '/pages/activity_detail/activity_detail'
url: '/pages/activity_detail/activity_detail?id=' + id
})
},
// 获取活动列表
getActivityList() {
this.$request
.post('/app-api/member/score-rule/list', { platform: 2 })
.then(({ code, data }) => {
// console.log(res)
if (code == 0 && data) {
this.activityList = data
}
})
}
}
}
......
......@@ -38,8 +38,8 @@
>
</view>
<view class="main-content">
<gift v-if="navIndex === 0" :userInfo="userInfo"></gift>
<points v-if="navIndex === 1"></points>
<gift v-show="navIndex === 0" :userInfo="userInfo"></gift>
<points v-show="navIndex === 1"></points>
</view>
</view>
</view>
......
......@@ -2,8 +2,8 @@
<view>
<dHeader :title="'兑换日志'"></dHeader>
<view class="container">
<view class="item" v-for="item in 6" :key="item" @click="toDetail">
<div class="item-title">订单V值</div>
<view class="item" v-for="item in list" :key="item.id" @click="toDetail(item.id)">
<div class="item-title">兑换礼品</div>
<div class="item-box">
<div class="box-img">
<image
......@@ -13,13 +13,13 @@
</div>
<div class="box-content">
<div class="content-text">
购买/充值满1000元即可赠送50积 分,满2000元送80积分不可看加满2000元送80积分
{{ locale === 'zh' ? item.rewardTitleZh : item.rewardTitleEn }}
</div>
<div class="content-time">2024-01-01 11:11:11</div>
<div class="content-time">{{ formatDate(item.createTime) }}</div>
</div>
<div class="box-right">
<view class="box-right-num">X1</view>
<view class="box-right-text">+50</view>
<view class="box-right-num">X{{ item.rewardCount }}</view>
<view class="box-right-text">-{{ item.scoreCount }}</view>
</div>
</div>
</view>
......@@ -33,11 +33,49 @@ export default {
components: {
dHeader
},
data() {
return {
list: []
}
},
created() {
this.getList()
},
computed: {
locale() {
return this.$lang.locale
}
},
methods: {
toDetail() {
toDetail(id) {
uni.navigateTo({
url: '/pages/exchange_detail/exchange_detail'
url: '/pages/exchange_detail/exchange_detail?id=' + id
})
},
// 获取礼品列表
async getList() {
try {
const memberId = this.$store.getters.id
const { code, data } = await this.$request.post('/app-api/reward/redeem/record/list', {
memberId: 68
})
if (code == 0 && data) {
this.list = data
}
} catch (error) {
console.log(error)
}
},
// 时间戳转换为YYYY-MM-DD HH:mm:ss
formatDate(time) {
const date = new Date(time)
const Y = date.getFullYear() + '-'
const M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-'
const D = date.getDate() + ' '
const h = date.getHours() + ':'
const m = date.getMinutes() + ':'
const s = date.getSeconds()
return Y + M + D + h + m + s
}
}
}
......
......@@ -53,8 +53,9 @@ export default {
// 获取列表
async getList() {
try {
const id = this.$store.getters.id
const { code, data } = await this.$request.post('/app-api/member/user-score/log', {
id: 68
id
})
if (code == 0 && data) {
this.list = data
......
This diff is collapsed.
## 1.9.1(2024-04-02)
- 修复 uni-popup-dialog vue3下使用value无法进行绑定的bug(双向绑定兼容旧写法)
## 1.9.0(2024-03-28)
- 修复 uni-popup-dialog 双向绑定时初始化逻辑修正
## 1.8.9(2024-03-20)
- 修复 uni-popup-dialog 数据输入时修正为双向绑定
## 1.8.8(2024-02-20)
- 修复 uni-popup 在微信小程序下出现文字向上闪动的bug
## 1.8.7(2024-02-02)
- 新增 uni-popup-dialog 新增属性focus:input模式下,是否自动自动聚焦
## 1.8.6(2024-01-30)
- 新增 uni-popup-dialog 新增属性maxLength:限制输入框字数
## 1.8.5(2024-01-26)
- 新增 uni-popup-dialog 新增属性showClose:控制关闭按钮的显示
## 1.8.4(2023-11-15)
- 新增 uni-popup 支持uni-app-x 注意暂时仅支持 `maskClick` `@open` `@close`
## 1.8.3(2023-04-17)
- 修复 uni-popup 重复打开时的 bug
## 1.8.2(2023-02-02)
- uni-popup-dialog 组件新增 inputType 属性
## 1.8.1(2022-12-01)
- 修复 nvue 下 v-show 报错
## 1.8.0(2022-11-29)
- 优化 主题样式
## 1.7.9(2022-04-02)
- 修复 弹出层内部无法滚动的bug
## 1.7.8(2022-03-28)
......
......@@ -10,14 +10,15 @@
</view>
<view v-else class="uni-dialog-content">
<slot>
<input class="uni-dialog-input" v-model="val" type="text" :placeholder="placeholderText" :focus="focus" >
<input class="uni-dialog-input" :maxlength="maxlength" v-model="val" :type="inputType"
:placeholder="placeholderText" :focus="focus">
</slot>
</view>
<view class="uni-dialog-button-group">
<view class="uni-dialog-button" @click="closeDialog">
<view class="uni-dialog-button" v-if="showClose" @click="closeDialog">
<text class="uni-dialog-button-text">{{closeText}}</text>
</view>
<view class="uni-dialog-button uni-border-left" @click="onOk">
<view class="uni-dialog-button" :class="showClose?'uni-border-left':''" @click="onOk">
<text class="uni-dialog-button-text uni-button-color">{{okText}}</text>
</view>
</view>
......@@ -28,16 +29,19 @@
<script>
import popup from '../uni-popup/popup.js'
import {
initVueI18n
initVueI18n
} from '@dcloudio/uni-i18n'
import messages from '../uni-popup/i18n/index.js'
const { t } = initVueI18n(messages)
const {
t
} = initVueI18n(messages)
/**
* PopUp 弹出层-对话框样式
* @description 弹出层-对话框样式
* @tutorial https://ext.dcloud.net.cn/plugin?id=329
* @property {String} value input 模式下的默认值
* @property {String} placeholder input 模式下输入提示
* @property {Boolean} focus input模式下是否自动聚焦,默认为true
* @property {String} type = [success|warning|info|error] 主题样式
* @value success 成功
* @value warning 提示
......@@ -46,8 +50,10 @@
* @property {String} mode = [base|input] 模式、
* @value base 基础对话框
* @value input 可输入对话框
* @showClose {Boolean} 是否显示关闭按钮
* @property {String} content 对话框内容
* @property {Boolean} beforeClose 是否拦截取消事件
* @property {Number} maxlength 输入
* @event {Function} confirm 点击确认按钮触发
* @event {Function} close 点击取消按钮触发
*/
......@@ -55,12 +61,30 @@
export default {
name: "uniPopupDialog",
mixins: [popup],
emits:['confirm','close'],
emits: ['confirm', 'close', 'update:modelValue', 'input'],
props: {
inputType: {
type: String,
default: 'text'
},
showClose: {
type: Boolean,
default: true
},
// #ifdef VUE2
value: {
type: [String, Number],
default: ''
},
// #endif
// #ifdef VUE3
modelValue: {
type: [Number, String],
default: ''
},
// #endif
placeholder: {
type: [String, Number],
default: ''
......@@ -85,19 +109,26 @@
type: Boolean,
default: false
},
cancelText:{
cancelText: {
type: String,
default: ''
},
confirmText:{
confirmText: {
type: String,
default: ''
},
maxlength: {
type: Number,
default: -1,
},
focus: {
type: Boolean,
default: true,
}
},
data() {
return {
dialogType: 'error',
focus: false,
val: ""
}
},
......@@ -125,7 +156,21 @@
}
},
value(val) {
this.val = val
if (this.maxlength != -1 && this.mode === 'input') {
this.val = val.slice(0, this.maxlength);
} else {
this.val = val
}
},
val(val) {
// #ifdef VUE2
// TODO 兼容 vue2
this.$emit('input', val);
// #endif
// #ifdef VUE3
// TODO 兼容 vue3
this.$emit('update:modelValue', val);
// #endif
}
},
created() {
......@@ -134,25 +179,25 @@
// this.popup.closeMask()
if (this.mode === 'input') {
this.dialogType = 'info'
this.val = this.value
this.val = this.value;
// #ifdef VUE3
this.val = this.modelValue;
// #endif
} else {
this.dialogType = this.type
}
},
mounted() {
this.focus = true
},
methods: {
/**
* 点击确认按钮
*/
onOk() {
if (this.mode === 'input'){
if (this.mode === 'input') {
this.$emit('confirm', this.val)
}else{
} else {
this.$emit('confirm')
}
if(this.beforeClose) return
if (this.beforeClose) return
this.popup.close()
},
/**
......@@ -160,17 +205,17 @@
*/
closeDialog() {
this.$emit('close')
if(this.beforeClose) return
if (this.beforeClose) return
this.popup.close()
},
close(){
close() {
this.popup.close()
}
}
}
</script>
<style lang="scss" >
<style lang="scss">
.uni-popup-dialog {
width: 300px;
border-radius: 11px;
......
......@@ -47,7 +47,7 @@
{
text: '支付宝',
icon: 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/d684ae40-50be-11eb-8ff1-d5dcf8779628.png',
name: 'wx'
name: 'ali'
},
{
text: 'QQ',
......
<template>
<view class="popup-root" v-if="isOpen" v-show="isShow" @click="clickMask">
<view @click.stop>
<slot></slot>
</view>
</view>
</template>
<script>
type CloseCallBack = ()=> void;
let closeCallBack:CloseCallBack = () :void => {};
export default {
emits:["close","clickMask"],
data() {
return {
isShow:false,
isOpen:false
}
},
props: {
maskClick: {
type: Boolean,
default: true
},
},
watch: {
// 设置show = true 时,如果没有 open 需要设置为 open
isShow:{
handler(isShow) {
// console.log("isShow",isShow)
if(isShow && this.isOpen == false){
this.isOpen = true
}
},
immediate:true
},
// 设置isOpen = true 时,如果没有 isShow 需要设置为 isShow
isOpen:{
handler(isOpen) {
// console.log("isOpen",isOpen)
if(isOpen && this.isShow == false){
this.isShow = true
}
},
immediate:true
}
},
methods:{
open(){
// ...funs : CloseCallBack[]
// if(funs.length > 0){
// closeCallBack = funs[0]
// }
this.isOpen = true;
},
clickMask(){
if(this.maskClick == true){
this.$emit('clickMask')
this.close()
}
},
close(): void{
this.isOpen = false;
this.$emit('close')
closeCallBack()
},
hiden(){
this.isShow = false
},
show(){
this.isShow = true
}
}
}
</script>
<style>
.popup-root {
position: fixed;
top: 0;
left: 0;
width: 750rpx;
height: 100%;
flex: 1;
background-color: rgba(0, 0, 0, 0.3);
justify-content: center;
align-items: center;
z-index: 99;
}
</style>
\ No newline at end of file
......@@ -5,7 +5,7 @@
:duration="duration" :show="showTrans" @click="onTap" />
<uni-transition key="2" :mode-class="ani" name="content" :styles="transClass" :duration="duration"
:show="showTrans" @click="onTap">
<view class="uni-popup__wrapper" :style="{ backgroundColor: bg }" :class="[popupstyle]" @click="clear">
<view class="uni-popup__wrapper" :style="getStyles" :class="[popupstyle]" @click="clear">
<slot />
</view>
</uni-transition>
......@@ -39,6 +39,7 @@
* @property {Boolean} isMaskClick = [true|false] 蒙版点击是否关闭弹窗
* @property {String} backgroundColor 主窗口背景色
* @property {String} maskBackgroundColor 蒙版颜色
* @property {String} borderRadius 设置圆角(左上、右上、右下和左下) 示例:"10px 10px 10px 10px"
* @property {Boolean} safeArea 是否适配底部安全区
* @event {Function} change 打开关闭弹窗触发,e={show: false}
* @event {Function} maskClick 点击遮罩触发
......@@ -86,6 +87,9 @@
type: String,
default: 'rgba(0, 0, 0, 0.4)'
},
borderRadius:{
type: String,
}
},
watch: {
......@@ -157,16 +161,25 @@
backgroundColor: 'rgba(0, 0, 0, 0.4)'
},
transClass: {
backgroundColor: 'transparent',
borderRadius: this.borderRadius || "0",
position: 'fixed',
left: 0,
right: 0
},
maskShow: true,
mkclick: true,
popupstyle: this.isDesktop ? 'fixforpc-top' : 'top'
popupstyle: 'top'
}
},
computed: {
getStyles() {
let res = { backgroundColor: this.bg };
if (this.borderRadius || "0") {
res = Object.assign(res, { borderRadius: this.borderRadius })
}
return res;
},
isDesktop() {
return this.popupWidth >= 500 && this.popupHeight >= 500
},
......@@ -221,6 +234,12 @@
this.setH5Visible()
},
// #endif
activated() {
this.setH5Visible(!this.showPopup);
},
deactivated() {
this.setH5Visible(true);
},
created() {
// this.mkclick = this.isMaskClick || this.maskClick
if (this.isMaskClick === null && this.maskClick === null) {
......@@ -240,10 +259,10 @@
this.maskClass.backgroundColor = this.maskBackgroundColor
},
methods: {
setH5Visible() {
setH5Visible(visible = true) {
// #ifdef H5
// fix by mehaotian 处理 h5 滚动穿透的问题
document.getElementsByTagName('body')[0].style.overflow = 'visible'
document.getElementsByTagName('body')[0].style.overflow = visible ? "visible" : "hidden";
// #endif
},
/**
......@@ -269,8 +288,7 @@
open(direction) {
// fix by mehaotian 处理快速打开关闭的情况
if (this.showPopup) {
clearTimeout(this.timer)
this.showPopup = false
return
}
let innerType = ['top', 'center', 'bottom', 'left', 'right', 'message', 'dialog', 'share']
if (!(direction && innerType.indexOf(direction) !== -1)) {
......@@ -324,7 +342,8 @@
position: 'fixed',
left: 0,
right: 0,
backgroundColor: this.bg
backgroundColor: this.bg,
borderRadius:this.borderRadius || "0"
}
// TODO 兼容 type 属性 ,后续会废弃
if (type) return
......@@ -348,7 +367,8 @@
right: 0,
bottom: 0,
paddingBottom: this.safeAreaInsets + 'px',
backgroundColor: this.bg
backgroundColor: this.bg,
borderRadius:this.borderRadius || "0",
}
// TODO 兼容 type 属性 ,后续会废弃
if (type) return
......@@ -360,7 +380,13 @@
*/
center(type) {
this.popupstyle = 'center'
this.ani = ['zoom-out', 'fade']
//微信小程序下,组合动画会出现文字向上闪动问题,再此做特殊处理
// #ifdef MP-WEIXIN
this.ani = ['fade']
// #endif
// #ifndef MP-WEIXIN
this.ani = ['zoom-out', 'fade']
// #endif
this.transClass = {
position: 'fixed',
/* #ifndef APP-NVUE */
......@@ -372,7 +398,8 @@
right: 0,
top: 0,
justifyContent: 'center',
alignItems: 'center'
alignItems: 'center',
borderRadius:this.borderRadius || "0"
}
// TODO 兼容 type 属性 ,后续会废弃
if (type) return
......@@ -388,6 +415,7 @@
bottom: 0,
top: 0,
backgroundColor: this.bg,
borderRadius:this.borderRadius || "0",
/* #ifndef APP-NVUE */
display: 'flex',
flexDirection: 'column'
......@@ -407,6 +435,7 @@
right: 0,
top: 0,
backgroundColor: this.bg,
borderRadius:this.borderRadius || "0",
/* #ifndef APP-NVUE */
display: 'flex',
flexDirection: 'column'
......
{
"id": "uni-popup",
"displayName": "uni-popup 弹出层",
"version": "1.7.9",
"version": "1.9.1",
"description": " Popup 组件,提供常用的弹层",
"keywords": [
"uni-ui",
......@@ -17,12 +17,8 @@
"directories": {
"example": "../../temps/example_temps"
},
"dcloudext": {
"category": [
"前端组件",
"通用组件"
],
"sale": {
"dcloudext": {
"sale": {
"regular": {
"price": "0.00"
},
......@@ -38,7 +34,8 @@
"data": "无",
"permissions": "无"
},
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui"
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui",
"type": "component-vue"
},
"uni_modules": {
"dependencies": [
......@@ -49,7 +46,8 @@
"platforms": {
"cloud": {
"tcb": "y",
"aliyun": "y"
"aliyun": "y",
"alipay": "n"
},
"client": {
"App": {
......
## 1.3.3(2024-04-23)
- 修复 当元素会受变量影响自动隐藏的bug
## 1.3.2(2023-05-04)
- 修复 NVUE 平台报错的问题
## 1.3.1(2021-11-23)
- 修复 init 方法初始化问题
## 1.3.0(2021-11-19)
......
......@@ -10,7 +10,10 @@ const nvueAnimation = uni.requireNativePlugin('animation')
class MPAnimation {
constructor(options, _this) {
this.options = options
this.animation = uni.createAnimation(options)
// 在iOS10+QQ小程序平台下,传给原生的对象一定是个普通对象而不是Proxy对象,否则会报parameter should be Object instead of ProxyObject的错误
this.animation = uni.createAnimation({
...options
})
this.currentStepAnimates = {}
this.next = 0
this.$ = _this
......
<template>
<view v-if="isShow" ref="ani" :animation="animationData" :class="customClass" :style="transformStyles" @click="onClick"><slot></slot></view>
<!-- #ifndef APP-NVUE -->
<view v-show="isShow" ref="ani" :animation="animationData" :class="customClass" :style="transformStyles" @click="onClick"><slot></slot></view>
<!-- #endif -->
<!-- #ifdef APP-NVUE -->
<view v-if="isShow" ref="ani" :animation="animationData" :class="customClass" :style="transformStyles" @click="onClick"><slot></slot></view>
<!-- #endif -->
</template>
<script>
......@@ -48,7 +53,11 @@ export default {
customClass:{
type: String,
default: ''
}
},
onceRender:{
type:Boolean,
default:false
},
},
data() {
return {
......@@ -245,7 +254,7 @@ export default {
},
animationType(type) {
return {
fade: type ? 1 : 0,
fade: type ? 0 : 1,
'slide-top': `translateY(${type ? '0' : '-100%'})`,
'slide-right': `translateX(${type ? '0' : '100%'})`,
'slide-bottom': `translateY(${type ? '0' : '100%'})`,
......
{
"id": "uni-transition",
"displayName": "uni-transition 过渡动画",
"version": "1.3.1",
"version": "1.3.3",
"description": "元素的简单过渡动画",
"keywords": [
"uni-ui",
......@@ -17,11 +17,7 @@
"directories": {
"example": "../../temps/example_temps"
},
"dcloudext": {
"category": [
"前端组件",
"通用组件"
],
"dcloudext": {
"sale": {
"regular": {
"price": "0.00"
......@@ -38,7 +34,8 @@
"data": "无",
"permissions": "无"
},
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui"
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui",
"type": "component-vue"
},
"uni_modules": {
"dependencies": ["uni-scss"],
......@@ -46,7 +43,8 @@
"platforms": {
"cloud": {
"tcb": "y",
"aliyun": "y"
"aliyun": "y",
"alipay": "n"
},
"client": {
"App": {
......
import request from './request'
// 获取字典
export async function getDict(key) {
const params = {
dictType: key,
pageSize: 999,
pageNum: 1
}
try {
const { data } = await request.get('/admin-api/system/dict-data/page', { params })
return data
} catch (error) {
throw error;
}
}
// 返回字典值
export async function getDictLabel(dict, value, locale, key = 'value') {
const dictKeys = locale === 'zh' ? 'label' : 'labelEn';
const findLabel = (list) => {
const item = list.find(item => item[key] === value);
return item ? item[dictKeys] : '';
};
if (Array.isArray(dict)) {
return findLabel(dict);
} else if (typeof dict === 'string') {
try {
const { list } = await getDict(dict);
return findLabel(list);
} catch (error) {
throw error;
}
}
return '';
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment