<template>
|
<div class="personalPage-box">
|
<div class="personalPage-title">账户信息</div>
|
<div class="personalPage-content">
|
<div class="content-item">
|
<div class="item-title">基础信息</div>
|
<div class="item-box">
|
<div class="info-box flex">
|
<span class="label">用户名:</span>
|
<span class="text">{{ userStore?.userInfo.name }}</span>
|
<span class="change-info hover" @click="changeUserInfo('password')">修改密码</span>
|
</div>
|
<div class="info-box flex">
|
<span class="label">微信认证:</span>
|
<span class="text no" v-if="!weChatState">未认证</span>
|
<span class="text yes" v-else>已认证</span>
|
<span class="change-info hover" v-if="!weChatState" @click="goBindWeChat()"
|
>立即认证</span
|
>
|
</div>
|
<div class="info-box flex">
|
<span class="label">绑定手机号:</span>
|
<span class="text" v-if="userStore?.userInfo?.phoneNumber">{{
|
userStore?.userInfo?.phoneNumber
|
}}</span>
|
<span class="text no" v-else>未绑定</span>
|
<span class="change-info hover" @click="changeUserInfo('phone')">{{
|
userStore?.userInfo?.phoneNumber ? '更换手机号' : '绑定'
|
}}</span>
|
</div>
|
<div class="info-box flex">
|
<span class="label">邮箱:</span>
|
<span class="text">{{
|
userStore?.userInfo?.Email ? userStore.userInfo?.Email : '--'
|
}}</span>
|
<span class="change-info hover" @click="changeUserInfo('email')">{{
|
userStore?.userInfo?.Email ? '更换邮箱' : '绑定邮箱'
|
}}</span>
|
</div>
|
</div>
|
</div>
|
<div class="content-item">
|
<div class="item-title flex jc-sb">
|
<span>用户类型</span>
|
<!-- <span class="change-info hover" @click="userTypeDialog = true">修改</span> -->
|
<span class="change-info hover" @click="updateUserInfo()">修改</span>
|
</div>
|
<div class="item-box">
|
<div class="info-box flex">
|
<span class="label">用户类型:</span>
|
<span class="text">{{ userInfo.userType }}</span>
|
</div>
|
</div>
|
</div>
|
<div class="content-item">
|
<div class="item-title flex jc-sb">
|
<span>教师认证</span>
|
<div>
|
<span class="change-info hover" v-if="teacherState == ''" @click="showTeacherDialog()"
|
>认证</span
|
>
|
<span
|
class="change-info hover"
|
@click="showTeacherDialog()"
|
v-if="teacherState == 'Normal' || teacherState == 'Reject'"
|
>修改</span
|
>
|
</div>
|
</div>
|
<div class="item-box">
|
<div class="info-box flex">
|
<span class="label">认证状态:</span>
|
<div class="text">
|
<span class="text wait" v-if="teacherState == 'WaitAudit'">等待审核</span>
|
<span class="text yes" v-else-if="teacherState == 'Normal'">已认证</span>
|
<span class="text no" v-else-if="teacherState == 'Reject'">已驳回</span>
|
<span class="text wait" v-if="teacherState === ''">待认证</span>
|
</div>
|
<div v-if="teacherState == 'Reject'">
|
<span class="title">驳回原因</span> :
|
<span @click="lookReason()" class="wait hover">查看原因</span>
|
</div>
|
</div>
|
</div>
|
</div>
|
<div class="content-item">
|
<div class="item-title flex jc-sb">
|
<span>我的积分</span>
|
<span class="record hover" @click="recordDialog()">积分记录</span>
|
</div>
|
<div class="item-box">
|
<div class="info-box flex">
|
<span class="label">积分:</span>
|
<span class="text">{{ userInfo.integral }}</span>
|
</div>
|
</div>
|
</div>
|
</div>
|
<!-- 修改密码/手机号/邮箱 -->
|
<el-dialog
|
@open="openChangePassword"
|
align-center
|
:close-on-click-modal="false"
|
destroy-on-close
|
v-model="userInfoDialog"
|
:title="
|
changeType == 'email' ? '更换邮箱' : changeType == 'password' ? '修改密码' : '更换手机号'
|
"
|
width="500"
|
class="myDialogs"
|
@close="closeUserInfoDialog(userFormRef)"
|
>
|
<div>
|
<el-form
|
ref="userFormRef"
|
:model="userInfoForm"
|
:rules="userFormRules"
|
label-width="140px"
|
class="userInfo"
|
status-icon
|
>
|
<el-form-item label="手机号:" prop="phone" v-if="changeType != 'email'">
|
<el-input
|
v-model="userInfoForm.phone"
|
autocomplete="off"
|
placeholder="请输入手机号"
|
:disabled="changeType == 'password'"
|
/>
|
</el-form-item>
|
<el-form-item label="邮箱:" prop="email" v-if="changeType == 'email'">
|
<el-input
|
v-model="userInfoForm.email"
|
autocomplete="off"
|
placeholder="请输入邮箱"
|
:disabled="formDisabled"
|
/>
|
</el-form-item>
|
<el-form-item
|
:label="changeType == 'email' ? '邮箱验证码:' : '短信验证码:'"
|
prop="code"
|
>
|
<el-input
|
v-model="userInfoForm.code"
|
autocomplete="off"
|
class="code-input"
|
placeholder="请输入验证码"
|
/>
|
<div class="code">
|
<el-button
|
type="primary"
|
class="btn"
|
@click="getVerifyCode()"
|
:disabled="countDown > 0"
|
>
|
{{
|
countDown > 0
|
? '验证码(' + countDown + 's)'
|
: changeType == 'email'
|
? '获取邮箱验证码'
|
: '获取短信验证码'
|
}}
|
</el-button>
|
</div>
|
</el-form-item>
|
<el-form-item label="新密码:" prop="password" v-if="changeType == 'password'">
|
<el-input
|
type="password"
|
v-model="userInfoForm.password"
|
autocomplete="off"
|
placeholder="请输入8-16位新密码,且不能为纯数字"
|
/>
|
</el-form-item>
|
<el-form-item label="确认密码:" prop="confirmPassword" v-if="changeType == 'password'">
|
<el-input
|
type="password"
|
v-model="userInfoForm.confirmPassword"
|
autocomplete="off"
|
placeholder="请输入确认密码"
|
/>
|
</el-form-item>
|
</el-form>
|
</div>
|
<template #footer>
|
<span class="myDialogs-footer">
|
<el-button @click="closeUserInfoDialog(userFormRef)">取消</el-button>
|
<el-button type="primary" @click="confirmInfo(userFormRef)" :loading="subLoading">
|
确定
|
</el-button>
|
</span>
|
</template>
|
</el-dialog>
|
<!-- 微信认证 -->
|
<el-dialog
|
align-center
|
:close-on-click-modal="false"
|
v-model="weChartDialog"
|
title="微信认证"
|
class="myDialogs"
|
>
|
<div>
|
<div class="qrcodeBox">
|
<!-- <wxlogin
|
:redirect_uri="wxLogin.redirectURL"
|
style="width: 300px; height: 400px; margin: -40px auto 0; overflow: hidden"
|
:appid="wxLogin.appid"
|
:scope="wxLogin.scope"
|
state="WeChatScanningCodeBind"
|
>
|
</wxlogin> -->
|
</div>
|
<p class="tips">使用微信扫一扫扫描二维码进行绑定</p>
|
</div>
|
</el-dialog>
|
<!-- 用户类型修改 -->
|
<login ref="loginRef"></login>
|
<!-- 查看原因 -->
|
<el-dialog
|
align-center
|
:close-on-click-modal="false"
|
v-model="dialogReason"
|
title="驳回原因"
|
class="myDialogs"
|
>
|
<div class="reason" v-if="reasonTxt">
|
{{ reasonTxt }}
|
</div>
|
<div v-else>无</div>
|
</el-dialog>
|
<!-- 积分记录 -->
|
<el-dialog
|
align-center
|
:close-on-click-modal="false"
|
v-model="integralRecord.recordDialog"
|
title="积分记录"
|
class="myDialogs"
|
>
|
<div class="recordTableBox">
|
<ul class="recordTable">
|
<li class="head">
|
<span class="label">类型</span>
|
<span class="value">数量</span>
|
<span>时间</span>
|
</li>
|
<li v-for="item in integralRecord.recordList" :key="item.key" class="body">
|
<span class="label">{{ item.type }}</span>
|
<span class="value" :class="item.value > 0 ? 'yes' : 'no'">{{
|
item.value > 0 ? '+' + item.value : item.value
|
}}</span>
|
<span>{{ item.createDate ? item.createDate : '-' }}</span>
|
</li>
|
<li class="total" v-if="integralRecord.recordList.length > 0">
|
<span class="label">总计</span>
|
<span class="value">{{ userInfo.integral }}</span>
|
</li>
|
<li v-if="integralRecord.recordList.length == 0" class="noData">无积分记录</li>
|
</ul>
|
</div>
|
</el-dialog>
|
<teacherCertification :isShow="teacherDialog" @dialog-Change="dialogChange" />
|
<!-- 滑动验证 -->
|
<el-dialog
|
v-model="sliderImgDialogVisable"
|
align-center
|
destroy-on-close="true"
|
width="420"
|
class="sliderImgDialog"
|
>
|
<verify :MG="MG" @loginImgVerify="loginImgVerify" />
|
</el-dialog>
|
</div>
|
</template>
|
|
<script setup lang="ts">
|
import { reactive, ref, inject, onMounted, watch } from 'vue'
|
import type { FormInstance, FormRules } from 'element-plus'
|
// import verify from '@/components/sliderImg/component/verify.vue'
|
// import '@/components/sliderImg/sliderImg.js'
|
// import '@/components/sliderImg/sliderImg.css'
|
import { ElMessage } from 'element-plus'
|
import tool from '@/assets/js/toolClass.js'
|
// import { useUserStore } from '@/store'
|
// import wxlogin from 'vue-wxlogin'
|
// import teacherCertification from '@/views/components/teacherCertification.vue'
|
// import login from '@/layout/components/login.vue'
|
// const userStore = useUserStore()
|
import { useRoute } from 'vue-router'
|
import moment from 'moment'
|
const route = useRoute()
|
const MG: any = inject('MG')
|
const config: any = inject('config')
|
|
const validatePhone = (rule: any, value: any, callback: any) => {
|
if (value === '') {
|
callback(new Error('请输入联系电话'))
|
} else {
|
if (!config.reg_tel.test(value)) {
|
callback(new Error('请输入正确格式的电话'))
|
}
|
callback()
|
}
|
}
|
const validateEmail = (rule: any, value: any, callback: any) => {
|
let myreg = /^[a-zA-Z0-9_.-]+@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.[a-zA-Z0-9]{2,6}$/
|
if (value === '') {
|
callback(new Error('请输入电子邮箱'))
|
} else {
|
if (!myreg.test(value)) {
|
callback(new Error('请输入正确格式的电子邮箱'))
|
}
|
callback()
|
}
|
}
|
|
const validatePassword = (rule: any, value: any, callback: any) => {
|
let myreg = /^(?!^\d+$)(?!^[a-zA-Z]+$)(?!^\W+$)[a-zA-Z\d\W]{8,16}$/
|
if (value === '') {
|
callback(new Error('请输入密码'))
|
} else {
|
if (!myreg.test(value)) {
|
callback(new Error('请输入正确格式的密码,8-16位,且不能为纯数字'))
|
}
|
callback()
|
}
|
}
|
|
// onMounted(() => {
|
// getWechatAuthenticationState()
|
// getIntegral()
|
// if (localStorage.getItem(config.tokenKey)) {
|
// getUserRole()
|
// }
|
// })
|
|
// watch(route, () => {
|
// bindWeChat()
|
// })
|
let subLoading = ref(false)
|
//用户信息
|
let weChatState = ref(false)
|
const userInfo = reactive({
|
userType: '',
|
integral: 0,
|
})
|
//基础信息
|
const userInfoDialog = ref(false)
|
let changeType = ref('password')
|
const imgCode = ref<string>() // 图形验证码url
|
let countDown = ref(0)
|
// function changeUserInfo(type) {
|
// changeType.value = type
|
// if (type == 'password') {
|
// if (userStore.userInfo?.phoneNumber) {
|
// getImgCapcha()
|
// userInfoDialog.value = true
|
// } else {
|
// ElMessage({
|
// message: '修改密码需短信验证,请绑定手机号后再修改密码!',
|
// type: 'warning'
|
// })
|
// }
|
// } else {
|
// getImgCapcha()
|
// userInfoDialog.value = true
|
// }
|
// }
|
// const getImgCapcha = () => {
|
// MG.identity.getImgCode().then((res) => {
|
// imgCode.value = 'data:image/png;base64,' + res
|
// })
|
// }
|
|
const userFormRef = ref<FormInstance>()
|
const userInfoForm = reactive({
|
phone: '',
|
email: '',
|
captcha: '',
|
code: '',
|
password: '',
|
confirmPassword: '',
|
})
|
const formDisabled = ref(false)
|
const userFormRules = reactive<FormRules<userInfoForm>>({
|
phone: [{ required: true, validator: validatePhone, trigger: 'blur' }],
|
email: [{ required: true, validator: validateEmail, trigger: 'blur' }],
|
captcha: [
|
{ required: true, message: '图形验证码不能为空', trigger: 'blur' },
|
{ min: 4, max: 4, message: '请输入 4 位验证码', trigger: 'blur' },
|
],
|
code: [{ required: true, message: '验证码不能为空', trigger: 'blur' }],
|
password: [{ required: true, validator: validatePassword, trigger: 'blur' }],
|
confirmPassword: [{ required: true, message: '确认密码不能为空', trigger: 'blur' }],
|
})
|
|
const getVerifyCode = async () => {
|
sliderImgDialogVisable.value = true
|
}
|
|
// 验证码倒计时
|
function getSecond(time: number) {
|
let timer: ReturnType<typeof setInterval> | null = null
|
if (!timer) {
|
countDown.value = time
|
timer = setInterval(() => {
|
countDown.value--
|
if (countDown.value == 0) {
|
if (timer) clearInterval(timer)
|
timer = null
|
}
|
}, 1000)
|
}
|
}
|
|
const closeUserInfoDialog = (formEl: FormInstance | undefined) => {
|
if (!formEl) return
|
formEl.resetFields()
|
countDown.value = 0
|
userInfoDialog.value = false
|
}
|
const confirmInfo = async (formEl: FormInstance | undefined) => {
|
if (!formEl) return
|
await formEl.validate((valid, fields) => {
|
if (valid) {
|
subLoading.value = true
|
if (changeType.value == 'password') {
|
if (userInfoForm.password != userInfoForm.confirmPassword) {
|
ElMessage({
|
message: '两次密码输入不一致',
|
type: 'warning',
|
})
|
return false
|
}
|
let query = {
|
phoneNumber: userInfoForm.phone,
|
phoneCaptcha: userInfoForm.code,
|
password: userInfoForm.password,
|
}
|
MG.identity.changePasswordByMobilePhone(query).then((res) => {
|
if (res) {
|
ElMessage({
|
message: '密码重置成功!',
|
type: 'success',
|
})
|
userInfoDialog.value = false
|
} else {
|
ElMessage({
|
message: '密码重置失败,请填写正确的验证码。',
|
type: 'error',
|
})
|
}
|
subLoading.value = false
|
})
|
} else if (changeType.value == 'phone') {
|
let query = {
|
phoneNumber: userInfoForm.phone,
|
phoneCaptcha: userInfoForm.code,
|
}
|
MG.identity.userSetPhoneNumber(query).then((res) => {
|
if (res == '验证码过期或错误') {
|
ElMessage({
|
message: res + ',请稍后重试',
|
type: 'error',
|
})
|
} else if (res == '此手机号码已被其它账号绑定') {
|
ElMessage({
|
message: res + ',请更换其他手机号。',
|
type: 'error',
|
})
|
} else {
|
ElMessage({
|
message: res,
|
type: 'success',
|
})
|
userStore.setUserInfo({
|
...userStore.userInfo,
|
phoneNumber: userInfoForm.phone,
|
})
|
userInfoDialog.value = false
|
}
|
subLoading.value = false
|
})
|
} else if (changeType.value == 'email') {
|
let query = {
|
eMail: userInfoForm.email,
|
captcha: userInfoForm.code,
|
}
|
|
MG.identity.bindingEmail(query).then((res) => {
|
if (res == '验证码过期') {
|
ElMessage({
|
message: res + ',请稍后重试',
|
type: 'error',
|
})
|
} else if (res == '此邮箱已被其它账号绑定') {
|
ElMessage({
|
message: res + ',请更换其他邮箱。',
|
type: 'error',
|
})
|
} else if (res == '验证码无效') {
|
ElMessage({
|
message: res,
|
type: 'error',
|
})
|
} else {
|
ElMessage({
|
message: res,
|
type: 'success',
|
})
|
userStore.setUserInfo({
|
...userStore.userInfo,
|
Email: userInfoForm.email,
|
})
|
userInfoDialog.value = false
|
}
|
subLoading.value = false
|
})
|
}
|
} else {
|
subLoading.value = false
|
}
|
})
|
}
|
// 滑动验证
|
const sliderImgDialogVisable = ref<boolean>(false)
|
const loginImgVerify = (code: string) => {
|
userInfoForm.captcha = code
|
sliderImgDialogVisable.value = false
|
if (changeType.value == 'phone' || changeType.value == 'password') {
|
MG.identity
|
.getPhoneCode({
|
phoneNumber: userInfoForm.phone,
|
imageCaptcha: userInfoForm.captcha,
|
appRefCode: config.appRefCode,
|
})
|
.then((res: any) => {
|
if (res == '验证码发送成功') {
|
ElMessage({
|
message: res,
|
type: 'success',
|
})
|
// 开启短信验证倒计时
|
getSecond(60)
|
} else {
|
ElMessage({
|
message: res,
|
type: 'error',
|
})
|
}
|
})
|
} else if (changeType.value == 'email') {
|
MG.identity
|
.getEmailCode({
|
sendEmail: userInfoForm.email,
|
captcha: userInfoForm.captcha,
|
appRefCode: config.appRefCode,
|
})
|
.then((res) => {
|
if (res == true) {
|
ElMessage({
|
message: '邮件已发送',
|
type: 'success',
|
})
|
} else {
|
ElMessage({
|
message: '邮件发送失败',
|
type: 'error',
|
})
|
}
|
})
|
}
|
}
|
//微信认证
|
let wxLogin = reactive({
|
appid: 'wx5cfe8b007a3c6f8c',
|
scope: 'snsapi_login',
|
redirectURL: encodeURIComponent(config.requestCtx + '/home/#/personalCenter'),
|
})
|
const getWechatAuthenticationState = () => {
|
MG.identity.checkBuildingWeChat({}).then((res: any) => {
|
if (res) {
|
weChatState.value = true
|
} else {
|
weChatState.value = false
|
}
|
})
|
}
|
const weChartDialog = ref(false)
|
function goBindWeChat() {
|
window.location.href = `https://open.weixin.qq.com/connect/qrconnect?appid=${wxLogin.appid}&scope=${wxLogin.scope}&redirect_uri=${wxLogin.redirectURL}&state=WeChatScanningCodeBind`
|
}
|
|
//绑定微信
|
const bindWeChat = () => {
|
var url = window.location.href
|
if (url.indexOf('WeChatScanningCodeBind') > -1) {
|
var querys = url.substring(url.indexOf('?') + 1).split('&')
|
var result = {}
|
for (var i = 0; i < querys.length; i++) {
|
var temp = querys[i].split('=')
|
if (temp.length < 2) {
|
result[temp[0]] = ''
|
} else {
|
result[temp[0]] = temp[1]
|
}
|
}
|
if (result && result.code) {
|
MG.identity
|
.bindingWeChat({
|
code: result.code,
|
})
|
.then((res) => {
|
if (res) {
|
ElMessage({
|
message: '绑定成功!',
|
type: 'success',
|
})
|
getWechatAuthenticationState()
|
weChartDialog.value = false
|
} else {
|
ElMessage({
|
message: '绑定失败,该微信已被绑定!',
|
type: 'error',
|
})
|
}
|
})
|
}
|
}
|
}
|
|
//用户类型
|
const loginRef = ref()
|
// const userTypeDialog = ref(false)
|
const userTypeActive = ref('')
|
const teacherType = ref('')
|
const teacherList = ref([
|
{
|
value: 'vocSchoolTeachers',
|
label: '中职教师',
|
},
|
{
|
value: 'vocCollegeTeachers',
|
label: '高职教师',
|
},
|
{
|
value: 'ordUniversityTeachers',
|
label: '本科教师',
|
},
|
{
|
value: 'primarySchoolTeachers',
|
label: '中小学教师',
|
},
|
{
|
value: 'kindergarteTeachers',
|
label: '幼儿园教师',
|
},
|
])
|
const userTypeList = ref([
|
{
|
value: 'Teacher',
|
label: '教师',
|
checked: false,
|
},
|
{
|
value: 'Student',
|
label: '学生',
|
checked: false,
|
},
|
{
|
value: 'otherReaders',
|
label: '其他读者',
|
checked: false,
|
},
|
])
|
|
// 修改用户类型调用注册时用户信息填写弹窗
|
const updateUserInfo = () => {
|
loginRef.value.updateUserInfo()
|
loginRef.value.signUp()
|
}
|
|
//教师认证
|
let teacherDialog = ref(false) //弹窗
|
let loading = ref(false)
|
const teacherState = ref(null)
|
const reasonTxt = ref('')
|
const userId = ref()
|
|
const dialogReason = ref(false)
|
//教师认证弹窗
|
function showTeacherDialog() {
|
teacherDialog.value = true
|
}
|
|
const dialogChange = (val: any) => {
|
getTeacherInfo()
|
if (val == false) {
|
teacherDialog.value = false
|
} else {
|
teacherDialog.value = true
|
}
|
}
|
|
// 修改密码弹窗打开
|
const openChangePassword = () => {
|
if (changeType.value == 'password' && userStore.userInfo?.phoneNumber) {
|
userInfoForm.phone = userStore.userInfo?.phoneNumber
|
}
|
}
|
|
// 获取登录用户身份
|
function getUserRole() {
|
loading.value = true
|
MG.identity.getCurrentAppUser().then((res: any) => {
|
if (res) {
|
if (res.lastLoginTime) {
|
localStorage.setItem('lastLoginTime', res.lastLoginTime)
|
}
|
//获取用户类型
|
let userTypeData = res.infoList.find((item: any) => item.type == 'userType')
|
if (userTypeData) {
|
userTypeActive.value = JSON.parse(userTypeData.data).userType
|
if (userTypeActive.value !== 'Student' && userTypeActive.value !== 'otherReaders') {
|
const index = userTypeList.value.findIndex((item) => item.value === 'Teacher')
|
if (index !== -1) {
|
userTypeList.value[index].checked = true
|
teacherType.value = JSON.parse(userTypeData.data).userType
|
}
|
userInfo.userType =
|
teacherList.value.find((item) => item.value === userTypeActive.value)?.label ?? ''
|
} else {
|
const index = userTypeList.value.findIndex((item) => item.value === userTypeActive.value)
|
if (index !== -1) {
|
userTypeList.value[index].checked = true
|
}
|
userInfo.userType =
|
userTypeList.value.find((item) => item.value === userTypeActive.value)?.label ?? ''
|
}
|
} else {
|
userInfo.userType = '-'
|
}
|
getTeacherInfo()
|
userId.value = res.userId
|
let customUser = res.infoList.find((item: any) => item.type == 'userInfo')
|
let teacherRole = res.roleLinks.find((item: any) => item.role.refCode == 'teacher')
|
let teacherInfos = res.infoList.find((item: any) => item.type == 'teacherInfo')
|
let wechatInfo = res.infoList.find((item: any) => item.type == 'WeChat')
|
let studentInfo = res.infoList.find((item: any) => item.type == 'Default')
|
let phoneInfo = res.secretList.find((item: any) => item.type == 'MobilePhone')
|
let emailInfo = res.secretList.find((item: any) => item.type == 'EMail')
|
const userData = {
|
userName: customUser && customUser.data ? JSON.parse(customUser.data).name : '',
|
school: customUser && customUser.data ? JSON.parse(customUser.data).school : '',
|
cityCode: customUser && customUser.data ? JSON.parse(customUser.data).cityCode : '',
|
address: customUser && customUser.data ? JSON.parse(customUser.data).address : '',
|
userType: userTypeData && userTypeData.data ? JSON.parse(userTypeData.data).userType : '',
|
}
|
if (teacherRole && teacherInfos) {
|
if (JSON.parse(teacherInfos.data).email && !emailInfo) {
|
userInfoForm.email = JSON.parse(teacherInfos.data).email
|
formDisabled.value = true
|
}
|
userStore.setUserInfo({
|
...userData,
|
...teacherInfos,
|
phoneNumber: phoneInfo?.credential,
|
Email: emailInfo ? emailInfo.credential : JSON.parse(teacherInfos.data).email,
|
icon: wechatInfo?.icon,
|
role: 'Teacher',
|
roleId: teacherRole.role.id,
|
userId: res.userId,
|
})
|
} else if (wechatInfo) {
|
userStore.setUserInfo({
|
...userData,
|
...wechatInfo,
|
phoneNumber: phoneInfo?.credential,
|
Email: emailInfo?.credential,
|
role: 'Student',
|
userId: res.userId,
|
})
|
} else if (studentInfo) {
|
userStore.setUserInfo({
|
...userData,
|
...studentInfo,
|
icon: wechatInfo?.icon,
|
phoneNumber: phoneInfo?.credential,
|
Email: emailInfo?.credential,
|
role: 'Student',
|
userId: res.userId,
|
})
|
}
|
}
|
})
|
}
|
|
//教师信息
|
function getTeacherInfo() {
|
const data = {
|
start: 0,
|
size: 10,
|
topicIdOrRefCode: 'teacherRoleApproval',
|
appRefCode: config.appRefCode,
|
sort: {
|
type: 'Desc',
|
field: 'CreateDate',
|
},
|
}
|
MG.ugc.getTopicMessageList(data).then((res) => {
|
try {
|
const resData = res.datas.find((i) => i.appUserCreator.userId == userId.value)
|
if (resData) {
|
teacherState.value = resData.state
|
if (resData.feedBack != null) {
|
reasonTxt.value = JSON.parse(resData.feedBack).reason
|
}
|
} else {
|
teacherState.value = ''
|
}
|
loading.value = false
|
} catch (error) {
|
loading.value = false
|
}
|
})
|
}
|
|
//原因查看
|
const lookReason = () => {
|
dialogReason.value = true
|
}
|
|
//积分
|
function getIntegral() {
|
MG.store
|
.getUserWallet({
|
type: 'integral',
|
})
|
.then((res) => {
|
userInfo.integral = res.balance
|
})
|
}
|
|
const integralRecord = reactive({
|
recordDialog: false,
|
recordList: [],
|
})
|
|
// 积分记录弹窗
|
function recordDialog() {
|
integralRecord.recordDialog = true
|
getRecordList()
|
}
|
|
//获取积分记录
|
function getRecordList() {
|
MG.store
|
.getWalletHistory({
|
Size: 999,
|
Start: 0,
|
sort: {
|
type: 'Desc',
|
field: 'CreateDate',
|
},
|
type: 'integral',
|
})
|
.then((res) => {
|
console.log(res, '积分记录')
|
if (res.datas.length > 0) {
|
res.datas.forEach((element) => {
|
element.createDate = moment(element.createDate).format('YYYY-MM-DD HH:mm:ss')
|
if (element.refType == 'sign') {
|
element.type = '每日登录'
|
}
|
if (element.refType == 'Reward') {
|
element.type = '上传资源奖励'
|
}
|
if (element.refType == 'OrderCoinBonus') {
|
element.type = '订单支付奖励'
|
}
|
if (element.refType == 'Order' && element.value < 0) {
|
element.type = '订单支付抵扣'
|
}
|
if (element.refType == 'Order' && element.value > 0) {
|
element.type = '订单取消退回'
|
}
|
if (element.refType == 'AdminRecharge') {
|
element.type = '管理员充值'
|
}
|
})
|
integralRecord.recordList = res.datas
|
}
|
})
|
}
|
</script>
|
<style lang="less" scoped>
|
.content-item {
|
.item-title {
|
line-height: 20px;
|
padding: 0 10px;
|
border-left: 3px solid #019e58;
|
font-family:
|
Microsoft YaHei UI,
|
Microsoft YaHei UI;
|
font-weight: 400;
|
font-size: 16px;
|
}
|
|
.item-box {
|
padding: 25px 13px;
|
|
.info-box {
|
padding: 10px 0;
|
font-family:
|
Microsoft YaHei UI,
|
Microsoft YaHei UI;
|
font-weight: 400;
|
font-size: 14px;
|
color: #333333;
|
line-height: 34px;
|
|
.label,
|
.text {
|
width: 300px;
|
}
|
}
|
}
|
|
.change-info {
|
color: #019e58;
|
}
|
|
.record {
|
color: #949494;
|
}
|
}
|
|
.userInfo {
|
.el-input {
|
width: 86%;
|
height: 38px;
|
}
|
|
.code-input {
|
width: 50%;
|
}
|
|
.code {
|
width: 130px;
|
height: 38px;
|
margin-left: 20px;
|
|
.imgCode {
|
width: 100%;
|
height: 100%;
|
}
|
|
.btn {
|
width: 100%;
|
height: 100%;
|
}
|
}
|
}
|
|
.qrcodeBox {
|
width: 300px;
|
height: 300px;
|
margin: 0 auto;
|
// border: 1px solid #c0ccda;
|
overflow: hidden;
|
|
img {
|
width: 100%;
|
height: 100%;
|
}
|
}
|
|
.tips {
|
text-align: center;
|
font-size: 14px;
|
color: #666;
|
margin-top: 30px;
|
}
|
|
.userTypeList {
|
width: 200px;
|
margin: 0 auto;
|
|
.item {
|
padding: 15px;
|
text-align: center;
|
margin: 20px 0;
|
border: 1px solid #d9d9d9;
|
border-radius: 3px;
|
}
|
|
.activeItem {
|
background-color: #019e58;
|
color: #fff;
|
}
|
}
|
|
.currentState {
|
margin-bottom: 22px;
|
|
.label {
|
width: 140px;
|
text-align: right;
|
}
|
}
|
|
.reasonBox {
|
margin-left: 100px;
|
font-size: 14px;
|
|
.title {
|
font-weight: bold;
|
}
|
}
|
.recordTableBox {
|
height: 600px;
|
overflow-y: auto;
|
}
|
|
.recordTable {
|
border: 1px solid #f4f4f4;
|
|
li {
|
display: flex;
|
line-height: 24px;
|
padding: 10px;
|
border-bottom: 1px solid #f4f4f4;
|
|
.label {
|
width: 220px;
|
}
|
|
.value {
|
width: 150px;
|
}
|
}
|
|
.head {
|
background-color: #f3f3f3;
|
}
|
.noData {
|
justify-content: center;
|
}
|
}
|
|
.total {
|
font-weight: bold;
|
}
|
|
.reason {
|
word-wrap: break-word;
|
}
|
</style>
|
<style lang="less">
|
.myDialogs {
|
width: 628px;
|
|
.el-dialog__header {
|
padding: 15px;
|
margin-right: 0;
|
border-bottom: 1px solid #f4f4f4;
|
}
|
|
.el-dialog__title {
|
font-weight: bold;
|
font-size: 16px;
|
}
|
|
.el-dialog__headerbtn {
|
top: 6px;
|
right: 6px;
|
}
|
|
.el-dialog__footer {
|
padding: 15px;
|
border-top: 1px solid #f4f4f4;
|
}
|
|
.myDialogs-footer {
|
.el-button {
|
padding: 0 20px;
|
}
|
}
|
}
|
|
.userTypeWall {
|
width: 100%;
|
height: 20px;
|
display: flex;
|
justify-content: space-between;
|
align-items: center;
|
margin-bottom: 40px;
|
color: #333;
|
padding-left: 15px;
|
border-left: 3px solid #019e58;
|
}
|
</style>
|