|
@@ -0,0 +1,93 @@
|
|
|
+<template>
|
|
|
+ <div id="changePwd">
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="24">
|
|
|
+ <el-col :span="24" class="top">
|
|
|
+ <NavBar v-show="navShow" :title="title" :isleftarrow="isleftarrow"> </NavBar>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="24" class="pwd">
|
|
|
+ <van-form :model="form">
|
|
|
+ <van-field v-model="form.oldpasswd" type="password" name="密码" label="旧密码" placeholder="请输入旧密码" />
|
|
|
+ <van-field v-model="form.newpasswd" type="password" name="密码" label="新密码" placeholder="请输入新密码" />
|
|
|
+ <el-col :span="24" class="btn1">
|
|
|
+ <el-button @click="resetForm('form')">取消</el-button>
|
|
|
+ <el-button type="primary" @click="submitForm('form')">提交</el-button>
|
|
|
+ </el-col>
|
|
|
+ </van-form>
|
|
|
+ </el-col>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import { mapState, createNamespacedHelpers } from 'vuex';
|
|
|
+import NavBar from '@/layout/common/topInfo.vue';
|
|
|
+const { mapActions: password } = createNamespacedHelpers('password');
|
|
|
+const { mapActions: login } = createNamespacedHelpers('login');
|
|
|
+export default {
|
|
|
+ name: 'changePwd',
|
|
|
+ props: {},
|
|
|
+ components: {
|
|
|
+ NavBar,
|
|
|
+ },
|
|
|
+ data: function() {
|
|
|
+ return {
|
|
|
+ // 头部标题
|
|
|
+ title: '',
|
|
|
+ // meta为true
|
|
|
+ isleftarrow: '',
|
|
|
+ // 返回
|
|
|
+ navShow: true,
|
|
|
+ form: {},
|
|
|
+ };
|
|
|
+ },
|
|
|
+ created() {},
|
|
|
+ methods: {
|
|
|
+ ...password(['query', 'update']),
|
|
|
+ ...login(['toGetMenu', 'logout']),
|
|
|
+ resetForm(formName) {
|
|
|
+ this.form = {};
|
|
|
+ },
|
|
|
+ async submitForm() {
|
|
|
+ let data = this.form;
|
|
|
+ data.id = this.user.uid;
|
|
|
+ let res = await this.update(data);
|
|
|
+ if (res.errcode === 0) {
|
|
|
+ this.$notify({
|
|
|
+ message: '修改成功',
|
|
|
+ type: 'success',
|
|
|
+ });
|
|
|
+ this.logout();
|
|
|
+ } else {
|
|
|
+ this.$notify({
|
|
|
+ message: res.errmsg,
|
|
|
+ type: 'danger',
|
|
|
+ });
|
|
|
+ }
|
|
|
+ this.$router.push({ path: '/live/index' });
|
|
|
+ },
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ ...mapState(['user']),
|
|
|
+ },
|
|
|
+ mounted() {
|
|
|
+ this.title = this.$route.meta.title;
|
|
|
+ this.isleftarrow = this.$route.meta.isleftarrow;
|
|
|
+ },
|
|
|
+ metaInfo() {
|
|
|
+ return { title: this.$route.meta.title };
|
|
|
+ },
|
|
|
+};
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="less" scoped>
|
|
|
+.top {
|
|
|
+ height: 46px;
|
|
|
+ overflow: hidden;
|
|
|
+}
|
|
|
+.btn1 {
|
|
|
+ text-align: center;
|
|
|
+ margin-top: 10px;
|
|
|
+}
|
|
|
+</style>
|