<template> <view class="container"> <uni-card :is-shadow="false" :border="false" padding="0" is-full> <view class="form"> <view class="line"> <uni-data-checkbox v-model="myVal" :localdata="checkList" @change="myChange"></uni-data-checkbox> <text>我的邮箱</text> <uni-easyinput v-model="email" disabled /> <view class="bind" @click="$util.to('../email/email')">绑定</view> </view> <view class="line"> <uni-data-checkbox v-model="otherVal" :localdata="checkList" @change="otherChange"></uni-data-checkbox> <text>其他邮箱</text> <uni-easyinput v-model="otherEmail" placeholder="请输入其他邮箱" /> </view> <button type="primary" @click="submit">确认</button> </view> </uni-card> </view> </template> <script> import { mailFileSend } from '@/apis/modules/parner.js' import { my } from '@/apis/modules/parner.js' export default { data() { return { id: '', email: '', otherEmail: '', myVal: 1, otherVal: '', checkList: [{ text: '', value: 1 }], files: [ '人工智能实验室建设方案-2020.1.docx', '大数据管理与应用专业建设方案.docx', '金融科技实验室建设方案V2.0.docx' ] } }, onShow() { const pages = getCurrentPages() const { options } = pages[pages.length - 1] this.id = options.id this.getInfo() }, methods: { // 获取个人信息 getInfo() { const team = uni.getStorageSync('team') my({ partnerId: team.partnerId, teamId: team.teamId }).then(({ my }) => { this.email = my.info.email }).catch(e => {}) }, myChange(e) { this.otherVal = '' }, otherChange(e) { this.myVal = '' }, // 提交 submit() { const { otherEmail } = this if (this.myVal && !this.email) return this.$util.errMsg('请选择其他邮箱!') if (this.otherVal && !otherEmail) return this.$util.errMsg('请输入邮箱!') mailFileSend({ copyWriting: this.files[this.id], mail: this.myVal ? this.email : otherEmail }).then(res => { this.$util.sucMsg('发送成功!') setTimeout(() => { uni.navigateBack() }, 1000) }).catch(e => {}) }, } } </script> <style scoped lang="scss"> .form { padding: 15px; background-color: #fff; } .line { display: flex; align-items: center; margin-bottom: 15px; text { margin: 0 10px 0 -20px; } } .bind { margin-left: 20rpx; font-size: 26rpx; color: #1f83ff; white-space: nowrap; } </style>