公众号登录
This commit is contained in:
@ -55,6 +55,7 @@ import RaddarChart from "./dashboard/RaddarChart";
|
||||
import PieChart from "./dashboard/PieChart";
|
||||
import BarChart from "./dashboard/BarChart";
|
||||
import LineChart from "./dashboard/LineChart";
|
||||
import { bindwx, isbindwx, wxlogin } from "@/api/system/user";
|
||||
//import { getSchoolCalendars } from "@/api/benyi/schoolcalendar";
|
||||
//备用进行班级园历显示操作import { getSchoolCalendarsClass } from "@/api/benyi/schoolcalendarclass";
|
||||
|
||||
@ -69,6 +70,7 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
code: "",
|
||||
calendarData: [],
|
||||
value: new Date(),
|
||||
// 查询参数
|
||||
@ -77,9 +79,31 @@ export default {
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.code = this.$route.query.code;
|
||||
//console.log(this.code);
|
||||
this.bindWxInfo();
|
||||
//this.getSchoolCalendarList();
|
||||
},
|
||||
methods: {
|
||||
async bindWxInfo() {
|
||||
await isbindwx().then((res) => {
|
||||
if (this.code != "" && this.code != null && res.msg == "1") {
|
||||
//console.log("绑定微信");
|
||||
this.$confirm("当前账号要绑定微信登录吗?", "警告", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning",
|
||||
})
|
||||
.then(() => {
|
||||
return bindwx(this.code);
|
||||
})
|
||||
.then(() => {
|
||||
this.msgSuccess("绑定成功");
|
||||
})
|
||||
.catch(function () {});
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 查询园历列表 */
|
||||
// getSchoolCalendarList() {
|
||||
// getSchoolCalendars(this.queryParams).then(response => {
|
||||
|
86
ruoyi-ui/src/views/system/user/wx/index.vue
Normal file
86
ruoyi-ui/src/views/system/user/wx/index.vue
Normal file
@ -0,0 +1,86 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-row :gutter="20">
|
||||
<el-col :xs="24" :sm="12" :md="8">
|
||||
<el-card class="box-card">
|
||||
<div slot="header" class="clearfix">
|
||||
<span>个人信息</span>
|
||||
</div>
|
||||
<div>
|
||||
<ul class="list-group list-group-striped">
|
||||
<li class="list-group-item">
|
||||
<svg-icon icon-class="user" />用户名称
|
||||
<div class="pull-right">{{ user.userName }}</div>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<svg-icon icon-class="phone" />手机号码
|
||||
<div class="pull-right">{{ user.phonenumber }}</div>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<svg-icon icon-class="email" />用户邮箱
|
||||
<div class="pull-right">{{ user.email }}</div>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<svg-icon icon-class="tree" />所属部门
|
||||
<div class="pull-right" v-if="user.dept">
|
||||
{{ user.dept.deptName }} / {{ postGroup }}
|
||||
</div>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<svg-icon icon-class="peoples" />所属角色
|
||||
<div class="pull-right">{{ roleGroup }}</div>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<svg-icon icon-class="date" />创建日期
|
||||
<div class="pull-right">{{ user.createTime }}</div>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<svg-icon icon-class="star" />是否绑定微信
|
||||
<div class="pull-right">{{ wxOpenId }}</div>
|
||||
</li>
|
||||
</ul>
|
||||
<el-button
|
||||
v-if="!wxOpenId"
|
||||
type="primary"
|
||||
size="mini"
|
||||
@click="submit"
|
||||
>绑定</el-button
|
||||
>
|
||||
</div>
|
||||
</el-card>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getUserProfile } from "@/api/system/user";
|
||||
|
||||
export default {
|
||||
name: "Profile",
|
||||
data() {
|
||||
return {
|
||||
code: "",
|
||||
user: {},
|
||||
roleGroup: {},
|
||||
postGroup: {},
|
||||
wxOpenId: "",
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getUser();
|
||||
},
|
||||
methods: {
|
||||
getUser() {
|
||||
getUserProfile().then((response) => {
|
||||
this.user = response.data;
|
||||
// console.log(this.user);
|
||||
this.wxOpenId = this.user.openId;
|
||||
this.roleGroup = response.roleGroup;
|
||||
this.postGroup = response.postGroup;
|
||||
});
|
||||
},
|
||||
submit() {},
|
||||
},
|
||||
};
|
||||
</script>
|
39
ruoyi-ui/src/views/wxlogin.vue
Normal file
39
ruoyi-ui/src/views/wxlogin.vue
Normal file
@ -0,0 +1,39 @@
|
||||
<template>
|
||||
<div class="dashboard-editor-container"></div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { wxlogin } from "@/api/system/user";
|
||||
import { getToken, setToken, removeToken } from "@/utils/auth";
|
||||
|
||||
export default {
|
||||
name: "wxLogin",
|
||||
data() {
|
||||
return {
|
||||
code: "",
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.code = this.$route.query.code;
|
||||
this.wxLogin();
|
||||
},
|
||||
methods: {
|
||||
wxLogin() {
|
||||
if(getToken()){
|
||||
this.$router.push({ path: "/index?code="+this.code });
|
||||
return;
|
||||
}
|
||||
if (this.code != "" && this.code != null) {
|
||||
//console.log("zhixing");
|
||||
wxlogin(this.code).then((res) => {
|
||||
console.log(res);
|
||||
if (res.code == "200") {
|
||||
setToken(res.token);
|
||||
this.$router.push({ path: "/index" });
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
Reference in New Issue
Block a user