合并代码

This commit is contained in:
sx 2025-02-23 13:32:05 +08:00
parent 409f137e89
commit d9f56e0fbb
11 changed files with 447 additions and 98 deletions

View File

@ -352,6 +352,47 @@ const mine = {
method: 'GET', method: 'GET',
}) })
}, },
/**
* 查看已绑定的银行卡列表
* @param {Object} param
*/
getBankCards(param) {
return util.request({
url: '/user/bank-cards/getBankCards',
data: param.data,
query: param.query,
method: 'GET',
load: true,
})
},
/**
* 添加银行卡
* @param {Object} param
*/
addBankCard(param) {
return util.request({
url: '/user/bank-cards/addBankCard',
data: param.data,
query: param.query,
method: 'POST',
load: true,
})
},
/**
* 删除银行卡
* @param {Object} param
*/
deleteBankCard(param) {
return util.request({
url: '/user/bank-cards/deleteBankCard',
path: param.path,
method: 'DELETE',
load: true,
})
},
} }
export default mine export default mine

View File

@ -190,6 +190,7 @@ const util = {
...params.header, ...params.header,
} }
console.log('token', token)
if (token) params.header["Authorization"] = `Bearer ${token}` if (token) params.header["Authorization"] = `Bearer ${token}`
// console.log('request url', url) // console.log('request url', url)
@ -213,7 +214,7 @@ const util = {
responseType: params.responseType || 'text', responseType: params.responseType || 'text',
// 请求成功返回 // 请求成功返回
success: res => { success: res => {
// console.log('request success', url, res, params.data ? params.data : '') console.log('request success', url, res, params.data ? params.data : '')
// 关闭加载效果 // 关闭加载效果
if (params.load) { if (params.load) {
uni.hideLoading() uni.hideLoading()
@ -224,8 +225,7 @@ const util = {
// 登出 // 登出
util.logout(() => { util.logout(() => {
util.alert('请先登录') util.alert('请先登录')
reject(res.data) // 链式回调0 reject(res.data)
// uni.reLaunch({ // uni.reLaunch({
// url: '/login/login', // url: '/login/login',
// }) // })
@ -235,7 +235,6 @@ const util = {
params.success ? params.success(res.data) : '' params.success ? params.success(res.data) : ''
// 链式回调 // 链式回调
resolve(res.data); resolve(res.data);
}, },
// 请求失败返回 // 请求失败返回
fail: res => { fail: res => {
@ -1410,17 +1409,17 @@ const util = {
* @param {Function} cb 回调函数 * @param {Function} cb 回调函数
*/ */
finalLogin(param, cb) { finalLogin(param, cb) {
try { // 登录令牌
// 登录令牌 const token = param.data
const token = param.data // 缓存token
// 缓存token uni.setStorageSync('token', token)
uni.setStorageSync('token', token) console.log('set token', token)
// 开启加载
uni.showLoading({
mask: true
})
// 开启加载
uni.showLoading({
mask: true
})
setTimeout(() => {
// 获取用户信息 // 获取用户信息
util.getUserinfo((userinfo) => { util.getUserinfo((userinfo) => {
// 登录 // 登录
@ -1435,9 +1434,7 @@ const util = {
// //
cb ? cb() : '' cb ? cb() : ''
}) })
} catch (ev) { }, 500)
console.log('finalLogin catch', ev)
}
}, },
// 登录腾讯聊天 // 登录腾讯聊天
@ -1767,7 +1764,7 @@ const util = {
success: (res) => { success: (res) => {
if (res && res.result) { if (res && res.result) {
let result = JSON.parse(res.result) let result = JSON.parse(res.result)
if (result.type == 'ADDFRIEND') { if (result.type == 'ADDFRIEND') {
uni.navigateTo({ uni.navigateTo({
url: `/pages/news/addFriend?account=${result.account}` url: `/pages/news/addFriend?account=${result.account}`
}); });

View File

@ -57,7 +57,6 @@
// //
function getMoreList() { function getMoreList() {
console.log('getMoreList', listPrototype)
if (listPrototype.total <= listPrototype.data.length) return if (listPrototype.total <= listPrototype.data.length) return
listPrototype.pageNum++ listPrototype.pageNum++
getList() getList()

View File

@ -158,7 +158,7 @@
<view class="li mtb30" v-for="(item,index) in team.sonUser" :key="item.id"> <view class="li mtb30" v-for="(item,index) in team.sonUser" :key="item.id">
<view class="menber df aic"> <view class="menber df aic">
<view class="count mr20 plr10 cfff br10" v-if="item.isShop == 1"></view> <view class="count mr20 plr10 cfff br10" v-if="item.isShop == 1"></view>
<view class="c333 f32">{{item.userNickname}}{{item.isShop}}</view> <view class="c333 f32">{{item.userNickname}}</view>
<template v-if="item.sonList[0]"> <template v-if="item.sonList[0]">
<uni-icons @click="lowTeam(item)" type="up" color="#A45EFF" size="28rpx" <uni-icons @click="lowTeam(item)" type="up" color="#A45EFF" size="28rpx"
v-if="item.showSecond" /> v-if="item.showSecond" />

View File

@ -17,6 +17,8 @@
import util from '@/common/js/util'; import util from '@/common/js/util';
// api // api
import api from '@/api/index.js' import api from '@/api/index.js'
// 手机状态栏
import statusBar from '@/components/header/statusBar.vue';
// 首页视频 // 首页视频
import indexVideo from '@/components/index/indexVideo.vue' import indexVideo from '@/components/index/indexVideo.vue'
// 评论弹窗 // 评论弹窗
@ -258,15 +260,41 @@
}) })
}) })
} }
/**
* 返回
*/
function handleBack() {
const pages = getCurrentPages()
// 如果页面栈数量大于1
if (pages.length > 1) {
uni.navigateBack()
} else {
uni.switchTab({
url: '/pages/index/index'
})
}
}
</script> </script>
<template> <template>
<view class="page f1"> <view class="page f1">
<view class="apex">
<statusBar />
<view class="head df fdr jcsb">
<view class="back" @click="handleBack">
<uni-icons type="left" color="#fff" size="40rpx" />
</view>
</view>
</view>
<!-- --> <!-- -->
<indexVideo ref="indexVideo" :statistic="statistic" :item="detail" :tabIndex="0" :isMine="isMine" :index="0" <indexVideo ref="indexVideo" :statistic="statistic" :item="detail" :tabIndex="0" :isMine="isMine" :index="0"
:current="0" mode="detail" @showComment="handleShowCommentAlt" @showCollect="handleShowCollectAlt" :current="0" mode="detail" @showComment="handleShowCommentAlt" @showCollect="handleShowCollectAlt"
@showShareFirend="handleShowShareFirend" @like="videoLike" @detailMenu="detailMenu" @showShareFirend="handleShowShareFirend" @like="videoLike" @detailMenu="detailMenu"
@dataCenter="handleDataCenter"@showProduct="handleShowProduct" @proBuy="handleProBuy" /> @dataCenter="handleDataCenter" @showProduct="handleShowProduct" @proBuy="handleProBuy" />
<!-- 评论弹窗 --> <!-- 评论弹窗 -->
<commentAlt ref="commentRef" /> <commentAlt ref="commentRef" />
@ -274,13 +302,27 @@
<collectAlt ref="collectRef" /> <collectAlt ref="collectRef" />
<!-- 分享到好友弹窗 --> <!-- 分享到好友弹窗 -->
<shareFirendAlt ref="shareFirendRef" /> <shareFirendAlt ref="shareFirendRef" />
<!-- 产品详情弹窗 --> <!-- 产品详情弹窗 -->
<productAlt ref="productAltRef" @buy="handleProductBuy" /> <productAlt ref="productAltRef" @buy="handleProductBuy" />
<!-- 产品立即下单弹窗 --> <!-- 产品立即下单弹窗 -->
<productSpecAlt ref="productSpecAltRef" :detail="productDetail" @confirm="handlePay" /> <productSpecAlt ref="productSpecAltRef" :detail="productDetail" @confirm="handlePay" />
</view> </view>
</template> </template>
<style lang="scss"> <style lang="scss" scoped>
// // 顶部
.apex {
position: fixed;
top: 0%;
left: 0;
right: 0;
// 返回
.back {
width: 40px;
height: 40px;
background-color: rgba(0, 0, 0, .8);
border-radius: 100rpx;
}
}
</style> </style>

View File

@ -7,6 +7,7 @@
ref, ref,
getCurrentInstance, getCurrentInstance,
reactive, reactive,
computed,
} from 'vue' } from 'vue'
import { import {
onLoad, onLoad,
@ -16,6 +17,8 @@
import util from '@/common/js/util'; import util from '@/common/js/util';
// api // api
import api from '@/api/index.js' import api from '@/api/index.js'
//
import statusBar from '@/components/header/statusBar.vue';
// //
import indexVideo from '@/components/index/indexVideo.vue' import indexVideo from '@/components/index/indexVideo.vue'
// //
@ -24,6 +27,10 @@
import collectAlt from '@/components/index/collect.vue' import collectAlt from '@/components/index/collect.vue'
// //
import shareFirendAlt from '@/components/index/shareFirend.vue' import shareFirendAlt from '@/components/index/shareFirend.vue'
//
import productAlt from '@/components/index/proDetailAlt.vue'
//
import productSpecAlt from '@/components/shop/detail/makeOrder.vue'
const { const {
proxy proxy
@ -34,11 +41,17 @@
const detail = reactive({}) const detail = reactive({})
// //
const isMine = ref(false) const isMine = ref(false)
//
const statistic = ref('0')
//
const userinfo = computed(() => uni.$store.state.userinfo)
onLoad((option) => { onLoad((option) => {
if (option.videoId) videoId.value = option.videoId if (option.videoId) videoId.value = option.videoId
// //
if (option.isMine && option.isMine != 'false') isMine.value = option.isMine if (option.isMine && option.isMine != 'false') isMine.value = option.isMine
//
if (option.statistic) statistic.value = option.statistic
// //
getVideoDetail() getVideoDetail()
@ -64,12 +77,7 @@
} }
}).then(rs => { }).then(rs => {
if (rs.code == 200) { if (rs.code == 200) {
const result = rs.data Object.assign(detail, rs.data)
result.format_videoUrl = util.format_url(result.videoUrl, 'video')
result.format_header = util.format_url(result.header, 'img')
Object.assign(detail, result)
// //
proxy.$refs.indexVideo.play() proxy.$refs.indexVideo.play()
@ -107,41 +115,38 @@
proxy.$refs.shareFirendRef.open() proxy.$refs.shareFirendRef.open()
} }
/** /**
* 视频点赞 * 视频点赞
* @param {Object} param 见下 * @param {Object} param 见下
* @param {Number} param.index 操作的视频下标 * @param {Number} param.index 操作的视频下标
* @param {Number|String} param.isLike 点赞操作 * @param {Number|String} param.isLike 0.点赞 1.取消点赞
* @param {Number|String} param.likeType 点赞类型 0.公开赞 1.隐私赞
*/ */
function videoLike(param) { function videoLike(param) {
const {
index,
isLike
} = param
const item = detail const item = detail
// const data = {
let type = 1 // id
// 0 1 3 videoId: item.id,
if (item.isLike == 0) type = isLike // id
likeUserId: userinfo.value.id,
// id
targetUserId: item.userId,
// 0. 1.
likeType: param.likeType,
// // 0. 1.
isLike: param.isLike,
}
// //
api.video.videoLike({ api.video.videoLike({
query: { data,
// 01 3
type,
// id
videoId: item.videoId,
}
}).then(rs => { }).then(rs => {
if (rs.code == 200) { if (rs.code == 200) {
// uni.$emit('updateVideo', {
item.isLike = { ...item,
0: 1, ...rs.data,
1: 0, })
3: 3,
} [type]
//
type == 1 ? item.likes-- : item.likes++
return return
} }
util.alert({ util.alert({
@ -206,17 +211,90 @@
* @param {Object} detail * @param {Object} detail
*/ */
function handleDataCenter(detail) { function handleDataCenter(detail) {
uni.navigateTo({
url: util.setUrl('/pages/index/dataCenter/dataCenter', {
videoId: detail.id,
})
})
}
/**
* 打开产品弹窗
* @param {Object} item 视频列表项
*/
function handleShowProduct(item) {
//
proxy.$refs.productAltRef.init(item.productId)
}
/**
* 商品弹窗购买
* @param {Object} product
*/
function handleProductBuy(product) {
Object.assign(productDetail, {}, product)
// //
proxy.$refs.productSpecAltRef.open()
}
/**
* 商品购买
* @param {Object} video 视频列表
*/
function handleProBuy(video) {
//
api.shop.productDetail({
query: {
// id
productionId: video.productId,
},
}).then(rs => {
if (rs.code == 200) {
//
handleProductBuy(rs.data)
return
}
util.alert({
content: rs.msg,
showCancel: false,
})
})
}
/**
* 返回
*/
function handleBack() {
const pages = getCurrentPages()
// 1
if (pages.length > 1) {
uni.navigateBack()
} else {
uni.switchTab({
url: '/pages/index/index'
})
}
} }
</script> </script>
<template> <template>
<view class="page f1"> <view class="page f1">
<view class="apex">
<statusBar />
<view class="head df fdr jcsb">
<view class="back" @click="handleBack">
<uni-icons type="left" color="#fff" size="40rpx" />
</view>
</view>
</view>
<!-- --> <!-- -->
<indexVideo ref="indexVideo" :statistic="1" :item="detail" :tabIndex="0" :isMine="isMine" :index="0" <indexVideo ref="indexVideo" :statistic="statistic" :item="detail" :tabIndex="0" :isMine="isMine" :index="0"
:current="0" mode="detail" @showComment="handleShowCommentAlt" @showCollect="handleShowCollectAlt" :current="0" mode="detail" @showComment="handleShowCommentAlt" @showCollect="handleShowCollectAlt"
@showShareFirend="handleShowShareFirend" @like="videoLike" @detailMenu="detailMenu" @showShareFirend="handleShowShareFirend" @like="videoLike" @detailMenu="detailMenu"
@dataCenter="handleDataCenter" /> @dataCenter="handleDataCenter" @showProduct="handleShowProduct" @proBuy="handleProBuy" />
<!-- 评论弹窗 --> <!-- 评论弹窗 -->
<commentAlt ref="commentRef" /> <commentAlt ref="commentRef" />
@ -224,9 +302,27 @@
<collectAlt ref="collectRef" /> <collectAlt ref="collectRef" />
<!-- 分享到好友弹窗 --> <!-- 分享到好友弹窗 -->
<shareFirendAlt ref="shareFirendRef" /> <shareFirendAlt ref="shareFirendRef" />
<!-- 产品详情弹窗 -->
<productAlt ref="productAltRef" @buy="handleProductBuy" />
<!-- 产品立即下单弹窗 -->
<productSpecAlt ref="productSpecAltRef" :detail="productDetail" @confirm="handlePay" />
</view> </view>
</template> </template>
<style lang="scss"> <style lang="scss" scoped>
// //
.apex {
position: fixed;
top: 0%;
left: 0;
right: 0;
//
.back {
width: 40px;
height: 40px;
background-color: rgba(0, 0, 0, .8);
border-radius: 100rpx;
}
}
</style> </style>

View File

@ -57,6 +57,7 @@
function getLst() { function getLst() {
api.mine.myComment({ api.mine.myComment({
query: { query: {
userId: userinfo.value.id,
pageNum: list.pageNum, pageNum: list.pageNum,
pageSize: list.pageSize, pageSize: list.pageSize,
} }
@ -79,7 +80,6 @@
}).finally(() => { }).finally(() => {
uni.stopPullDownRefresh() uni.stopPullDownRefresh()
}) })
} }
</script> </script>

View File

@ -1,5 +1,82 @@
<script setup> <script setup>
// //
import {
ref,
computed,
reactive,
} from 'vue'
import {
useStore
} from 'vuex'
import {
onLoad,
onUnload,
} from '@dcloudio/uni-app'
//
import util from '@/common/js/util.js'
// api
import api from '@/api/index.js'
//
const list = reactive([])
//
const options = reactive([{
text: '解绑',
style: {
backgroundColor: '#007aff'
},
cb: (event) => removeBank(event)
}])
onLoad(() => {
//
getList()
//
addListener()
})
onUnload(() => {
//
removeListener()
})
//
function addListener() {
uni.$on('updateBindingBank', () => {
//
getList()
})
}
//
function removeListener() {
uni.$off('updateBindingBank')
}
//
function getList() {
api.mine.getBankCards({}).then(rs => {
if (rs.code == 200) {
Object.assign(list, rs.data)
list.push({
bankName: "建设银行",
cardHolderName: "商旭",
cardId: "1",
cardNumber: "6217002270031535710",
cardType: "DEBIT",
createTime: null,
delFlag: "0",
isDefault: null,
updateTime: null,
userId: 13,
})
return
}
util.alert({
content: rs.msg,
showCancel: false,
})
})
}
// //
function link(url) { function link(url) {
@ -7,18 +84,60 @@
url, url,
}) })
} }
/**
* 右滑菜单项点击
* @param {Object} event
*/
function handleItem(event, item) {
console.log('event', event, item)
item.cb(item)
}
/**
* 删除银行卡
* @param {Object} item 银行卡信息
*/
function removeBank(item) {
util.alert({
content: '删除后不可恢复,确认删除?',
}).then(rs => {
api.mine.deleteBankCard({
path: [item.cardId],
}).then(rs => {
if (rs.code == 200) {
//
getList()
return
}
util.alert({
content: rs.msg,
showCancel: false,
})
})
})
}
</script> </script>
<template> <template>
<view class="app"> <view class="app">
<view class="list"> <view class="list">
<view class="card item" v-for="(item,index) in 3" :key="index"> <uni-swipe-action ref="swipeAction">
<view class="name">很行银行</view> <view class="card item" v-for="(item,index) in list" :key="index">
<view class="type">储蓄卡</view> <uni-swipe-action-item :right-options="options" @click="handleItem($event,item)">
<view class="number">**** **** **** 0896</view> <view class="main ptb30 plr40">
</view> <view class="name">{{item.bankName}}</view>
<view class="type">
<text v-if="item.cardType == 'DEBIT'">储蓄卡</text>
<text v-else-if="item.cardType == 'CREDIT'">信用卡</text>
</view>
<view class="number">{{item.cardNumber}}</view>
</view>
</uni-swipe-action-item>
</view>
</uni-swipe-action>
<view class="item add rows" @click="link('/pages/mine/setting/bankCardAdd')"> <view class="item add rows ptb30 plr40" @click="link('/pages/mine/setting/bankCardAdd')">
<view>添加银行卡</view> <view>添加银行卡</view>
<uni-icons type="right" color="#999" /> <uni-icons type="right" color="#999" />
</view> </view>
@ -27,10 +146,11 @@
</template> </template>
<style lang="scss"> <style lang="scss">
//
.list { .list {
.item { .item {
overflow: hidden;
margin: 20rpx; margin: 20rpx;
padding: 30rpx 40rpx;
border-radius: 25rpx; border-radius: 25rpx;
} }

View File

@ -1,30 +1,83 @@
<script setup> <script setup>
// //
import { import {
reactive ref,
} from 'vue'; reactive,
computed,
} from 'vue'
import {
useStore
} from 'vuex'
import {
onLoad,
} from '@dcloudio/uni-app'
//
import util from '@/common/js/util.js'
// api
import api from '@/api/index.js'
//
import getCode from '@/components/getCode/getCode' import getCode from '@/components/getCode/getCode'
// //
const bankList = reactive([ const bankList = reactive([])
{ //
name: '银行卡1', const form = reactive({
}, cardNumber: '',
{ phoneNumber: '',
name: '银行卡2', userIdCard: '',
}, userRealName: '',
{ })
name: '银行卡3',
}, //
]) function handleSubmit() {
const data = {
...form
}
//
if (!data.phoneNumber) {
util.alert('手机号不能为空')
return
}
if (!data.userIdCard) {
util.alert('身份证号不能为空')
return
}
if (!data.cardNumber) {
util.alert('用户手机号不能为空')
return
}
if (!data.userRealName) {
util.alert('真实姓名不能为空')
return
}
//
api.mine.addBankCard({
data,
}).then(rs => {
if (rs.code == 200) {
uni.$emit('updateBindingBank')
util.alert('添加成功')
setTimeout(() => {
uni.navigateBack()
}, 500)
return
}
util.alert({
content: rs.msg,
showCancel: false,
})
})
}
</script> </script>
<template> <template>
<view class="appbw"> <view class="appbw">
<!-- 表单 --> <!-- 表单 -->
<view class="form mtb30 mlr40"> <view class="form mtb30 mlr40">
<!-- <view class="line">
<view class="line">
<view class="title">银行卡类型</view> <view class="title">银行卡类型</view>
<view class="inputBox"> <view class="inputBox">
<picker :range="bankList" range-key="name"> <picker :range="bankList" range-key="name">
@ -34,48 +87,47 @@
</view> </view>
</picker> </picker>
</view> </view>
</view> </view> -->
<view class="line"> <view class="line">
<view class="title">银行卡卡号</view> <view class="title">银行卡卡号</view>
<view class="inputBox"> <view class="inputBox">
<input class="input" type="text" placeholder="请输入银行卡卡号" /> <input class="input" v-model="form.cardNumber" type="text" placeholder="请输入银行卡卡号" />
</view> </view>
</view> </view>
<view class="line"> <view class="line">
<view class="title">姓名</view> <view class="title">姓名</view>
<view class="inputBox"> <view class="inputBox">
<input class="input" type="text" placeholder="请输入姓名" /> <input class="input" v-model="form.userRealName" type="text" placeholder="请输入姓名" />
</view> </view>
</view> </view>
<view class="line"> <view class="line">
<view class="title">身份证号</view> <view class="title">身份证号</view>
<view class="inputBox"> <view class="inputBox">
<input class="input" type="text" placeholder="请输入身份证号" /> <input class="input" v-model="form.userIdCard" type="text" placeholder="请输入身份证号" />
</view> </view>
</view> </view>
<view class="line"> <view class="line">
<view class="title">手机号银行绑定的手机号</view> <view class="title">手机号银行绑定的手机号</view>
<view class="inputBox rows"> <view class="inputBox">
<input class="input" type="text" placeholder="请输入手机号" /> <input class="input" v-model="form.phoneNumber" type="text" placeholder="请输入手机号" />
</view>
</view>
<!-- <view class="line">
<view class="title">验证码</view>
<view class="inputBox rows">
<input class="input" type="text" placeholder="请输入验证码" />
<view class="getCode btn black plr30"> <view class="getCode btn black plr30">
<getCode /> <getCode />
</view> </view>
</view> </view>
</view> </view> -->
<view class="line"> <view class="btn lg black mt50" @click="handleSubmit">绑定</view>
<view class="title">验证码</view>
<view class="inputBox">
<input class="input" type="text" placeholder="请输入验证码" />
</view>
</view>
<view class="btn lg black mt50">绑定</view>
</view> </view>
<view class="fill"></view> <view class="fill"></view>

View File

@ -1,4 +1,5 @@
<script setup> <script setup>
//
import { import {
ref, ref,
computed, computed,

View File

@ -66,6 +66,7 @@ updateOrderDetail 更新订单详情
updateUserProduct 更新用户商品 updateUserProduct 更新用户商品
updateBindingAccount 更新绑定账号 updateBindingAccount 更新绑定账号
selectBindingBank 选择绑定的银行卡 selectBindingBank 选择绑定的银行卡
updateBindingBank 更新绑定的银行卡
缓存 缓存
--- ---