mirror of
https://github.com/kerwincui/FastBee.git
synced 2025-10-14 20:25:58 +08:00
新增以下内容1.客户端查看详情和断开连接,2.规则引擎的增删改查,3.资源的增删改查,
This commit is contained in:
44
vue/src/api/iot/platform.js
Normal file
44
vue/src/api/iot/platform.js
Normal file
@@ -0,0 +1,44 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询第三方登录平台控制列表
|
||||
export function listPlatform(query) {
|
||||
return request({
|
||||
url: '/iot/platform/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询第三方登录平台控制详细
|
||||
export function getPlatform(socialPlatformId) {
|
||||
return request({
|
||||
url: '/iot/platform/' + socialPlatformId,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增第三方登录平台控制
|
||||
export function addPlatform(data) {
|
||||
return request({
|
||||
url: '/iot/platform',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改第三方登录平台控制
|
||||
export function updatePlatform(data) {
|
||||
return request({
|
||||
url: '/iot/platform',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除第三方登录平台控制
|
||||
export function delPlatform(socialPlatformId) {
|
||||
return request({
|
||||
url: '/iot/platform/' + socialPlatformId,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
@@ -56,4 +56,59 @@ export function getCodeImg() {
|
||||
method: 'get',
|
||||
timeout: 20000
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
//查看是否存在bindId
|
||||
export function checkBindId(bindId) {
|
||||
return request({
|
||||
url: '/auth/checkBindId/' + bindId,
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
|
||||
//查看是否存在errorId
|
||||
export function getErrorMsg(errorId) {
|
||||
return request({
|
||||
url: '/auth/getErrorMsg/' + errorId,
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
|
||||
// 登录方法
|
||||
export function bindLogin(username, password, code, uuid, bindId) {
|
||||
const data = {
|
||||
username,
|
||||
password,
|
||||
code,
|
||||
uuid,
|
||||
bindId
|
||||
}
|
||||
return request({
|
||||
url: '/auth/bind/login',
|
||||
headers: {
|
||||
isToken: false
|
||||
},
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 注册方法
|
||||
export function bindRegister(data) {
|
||||
return request({
|
||||
url: '/auth/bind/register',
|
||||
headers: {
|
||||
isToken: false
|
||||
},
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
//跳转登录
|
||||
export function redirectLogin(loginId) {
|
||||
return request({
|
||||
url: '/auth/login/' + loginId,
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import { login, logout, getInfo } from '@/api/login'
|
||||
import { getToken, setToken, removeToken } from '@/utils/auth'
|
||||
import {bindLogin, getInfo, login, logout, redirectLogin} from '@/api/login'
|
||||
import {getToken, removeToken, setToken} from '@/utils/auth'
|
||||
|
||||
const user = {
|
||||
state: {
|
||||
@@ -30,13 +30,36 @@ const user = {
|
||||
|
||||
actions: {
|
||||
// 登录
|
||||
Login({ commit }, userInfo) {
|
||||
Login({commit}, userInfo) {
|
||||
const username = userInfo.username.trim()
|
||||
const password = userInfo.password
|
||||
const code = userInfo.code
|
||||
const uuid = userInfo.uuid
|
||||
const bindId = userInfo.bindId;
|
||||
return new Promise((resolve, reject) => {
|
||||
login(username, password, code, uuid).then(res => {
|
||||
if (bindId === undefined || bindId === "") {
|
||||
login(username, password, code, uuid).then(res => {
|
||||
setToken(res.token)
|
||||
commit('SET_TOKEN', res.token)
|
||||
resolve()
|
||||
}).catch(error => {
|
||||
reject(error)
|
||||
})
|
||||
} else {
|
||||
bindLogin(username, password, code, uuid, bindId).then(res => {
|
||||
setToken(res.token)
|
||||
commit('SET_TOKEN', res.token)
|
||||
resolve()
|
||||
}).catch(error => {
|
||||
reject(error)
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
RedirectLogin({commit}, loginId) {
|
||||
return new Promise((resolve, reject) => {
|
||||
redirectLogin(loginId).then(res => {
|
||||
setToken(res.token)
|
||||
commit('SET_TOKEN', res.token)
|
||||
resolve()
|
||||
@@ -47,7 +70,7 @@ const user = {
|
||||
},
|
||||
|
||||
// 获取用户信息
|
||||
GetInfo({ commit, state }) {
|
||||
GetInfo({commit, state}) {
|
||||
return new Promise((resolve, reject) => {
|
||||
getInfo().then(res => {
|
||||
const user = res.user
|
||||
@@ -68,7 +91,7 @@ const user = {
|
||||
},
|
||||
|
||||
// 退出系统
|
||||
LogOut({ commit, state }) {
|
||||
LogOut({commit, state}) {
|
||||
return new Promise((resolve, reject) => {
|
||||
logout(state.token).then(() => {
|
||||
commit('SET_TOKEN', '')
|
||||
@@ -83,7 +106,7 @@ const user = {
|
||||
},
|
||||
|
||||
// 前端 登出
|
||||
FedLogOut({ commit }) {
|
||||
FedLogOut({commit}) {
|
||||
return new Promise(resolve => {
|
||||
commit('SET_TOKEN', '')
|
||||
removeToken()
|
||||
|
@@ -1,10 +1,10 @@
|
||||
import axios from 'axios'
|
||||
import { Notification, MessageBox, Message, Loading } from 'element-ui'
|
||||
import {Loading, Message, MessageBox, Notification} from 'element-ui'
|
||||
import store from '@/store'
|
||||
import { getToken } from '@/utils/auth'
|
||||
import {getToken} from '@/utils/auth'
|
||||
import errorCode from '@/utils/errorCode'
|
||||
import { tansParams, blobValidate } from "@/utils/ruoyi";
|
||||
import { saveAs } from 'file-saver'
|
||||
import {blobValidate, tansParams} from "@/utils/ruoyi";
|
||||
import {saveAs} from 'file-saver'
|
||||
|
||||
let downloadLoadingInstance;
|
||||
|
||||
@@ -65,6 +65,8 @@ service.interceptors.response.use(res => {
|
||||
type: 'error'
|
||||
})
|
||||
return Promise.reject(new Error(msg))
|
||||
} else if (code === 502) {
|
||||
return Promise.reject('error')
|
||||
} else if (code !== 200) {
|
||||
Notification.error({
|
||||
title: msg
|
||||
|
366
vue/src/views/iot/platform/index.vue
Normal file
366
vue/src/views/iot/platform/index.vue
Normal file
@@ -0,0 +1,366 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form v-show="showSearch" ref="queryForm" :inline="true" :model="queryParams" label-width="85px">
|
||||
<el-form-item label="第三方平台" prop="platform">
|
||||
<el-select v-model="queryParams.platform" clearable placeholder="请选择第三方平台" size="small">
|
||||
<el-option
|
||||
v-for="dict in dict.type.iot_social_platform"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-select v-model="queryParams.status" clearable placeholder="请选择 0:启用 ,1:禁用" size="small">
|
||||
<el-option
|
||||
v-for="dict in dict.type.iot_social_platform_status"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
icon="el-icon-plus"
|
||||
size="mini"
|
||||
@click="handleAdd"
|
||||
v-hasPermi="['iot:platform:add']"
|
||||
>新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
icon="el-icon-edit"
|
||||
size="mini"
|
||||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
v-hasPermi="['iot:platform:edit']"
|
||||
>修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="el-icon-delete"
|
||||
size="mini"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
v-hasPermi="['iot:platform:remove']"
|
||||
>删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="el-icon-download"
|
||||
size="mini"
|
||||
@click="handleExport"
|
||||
v-hasPermi="['iot:platform:export']"
|
||||
>导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="platformList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center"/>
|
||||
<el-table-column align="center" label="登录平台主键" prop="socialPlatformId"/>
|
||||
<el-table-column align="center" label="第三方平台" prop="platform">
|
||||
<template slot-scope="scope">
|
||||
<dict-tag :options="dict.type.iot_social_platform" :value="scope.row.platform"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="状态" prop="status">
|
||||
<template slot-scope="scope">
|
||||
<dict-tag :options="dict.type.iot_social_platform_status" :value="scope.row.status"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="第三方平台申请Id" align="center" prop="clientId"/>
|
||||
<el-table-column label="第三方平台密钥" align="center" prop="secretKey"/>
|
||||
<el-table-column label="用户认证后跳转地址" align="center" prop="redirectUri"/>
|
||||
<el-table-column align="center" label="创建者" prop="createBy"/>
|
||||
<el-table-column align="center" label="创建时间" prop="createTime" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="更新时间" prop="updateTime" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.updateTime, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="更新者" prop="updateBy"/>
|
||||
<el-table-column align="center" label="备注" prop="remark"/>
|
||||
<el-table-column align="center" label="绑定注册登录uri,http://localhost/login?bindId=" prop="bindUri"/>
|
||||
<el-table-column align="center" label="跳转登录uri,http://localhost/login?loginId=" prop="redirectLoginUri"/>
|
||||
<el-table-column align="center" label="错误提示uri,http://localhost/login?errorId=" prop="errorMsgUri"/>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['iot:platform:edit']"
|
||||
>修改
|
||||
</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['iot:platform:remove']"
|
||||
>删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<!-- 添加或修改第三方登录平台控制对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="第三方平台" prop="platform">
|
||||
<el-select v-model="form.platform" placeholder="请选择第三方平台">
|
||||
<el-option
|
||||
v-for="dict in dict.type.iot_social_platform"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label=" 0:启用 ,1:禁用" prop="status">
|
||||
<el-select v-model="form.status" placeholder="请选择 0:启用 ,1:禁用">
|
||||
<el-option
|
||||
v-for="dict in dict.type.iot_social_platform_status"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="第三方平台申请Id" prop="clientId">
|
||||
<el-input v-model="form.clientId" placeholder="请输入第三方平台申请Id"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="第三方平台密钥" prop="secretKey">
|
||||
<el-input v-model="form.secretKey" placeholder="请输入第三方平台密钥"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="用户认证后跳转地址" prop="redirectUri">
|
||||
<el-input v-model="form.redirectUri" placeholder="请输入用户认证后跳转地址"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="删除标记位(0代表存在,2代表删除)" prop="delFlag">
|
||||
<el-input v-model="form.delFlag" placeholder="请输入删除标记位(0代表存在,2代表删除)"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" placeholder="请输入内容" type="textarea"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="绑定注册登录uri,http://localhost/login?bindId=" prop="bindUri">
|
||||
<el-input v-model="form.bindUri" placeholder="请输入绑定注册登录uri,http://localhost/login?bindId="/>
|
||||
</el-form-item>
|
||||
<el-form-item label="跳转登录uri,http://localhost/login?loginId=" prop="redirectLoginUri">
|
||||
<el-input v-model="form.redirectLoginUri" placeholder="请输入跳转登录uri,http://localhost/login?loginId="/>
|
||||
</el-form-item>
|
||||
<el-form-item label="错误提示uri,http://localhost/login?errorId=" prop="errorMsgUri">
|
||||
<el-input v-model="form.errorMsgUri" placeholder="请输入错误提示uri,http://localhost/login?errorId="/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {addPlatform, delPlatform, getPlatform, listPlatform, updatePlatform} from "@/api/iot/platform";
|
||||
|
||||
export default {
|
||||
name: "Platform",
|
||||
dicts: ['iot_social_platform', 'iot_social_platform_status'],
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 第三方登录平台控制表格数据
|
||||
platformList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
platform: null,
|
||||
status: null,
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
platform: [
|
||||
{required: true, message: "第三方平台不能为空", trigger: "change"}
|
||||
],
|
||||
status: [
|
||||
{required: true, message: " 0:启用 ,1:禁用不能为空", trigger: "change"}
|
||||
],
|
||||
clientId: [
|
||||
{required: true, message: "第三方平台申请Id不能为空", trigger: "blur"}
|
||||
],
|
||||
secretKey: [
|
||||
{required: true, message: "第三方平台密钥不能为空", trigger: "blur"}
|
||||
],
|
||||
redirectUri: [
|
||||
{required: true, message: "用户认证后跳转地址不能为空", trigger: "blur"}
|
||||
],
|
||||
bindUri: [
|
||||
{required: true, message: "绑定注册登录uri,http://localhost/login?bindId=不能为空", trigger: "blur"}
|
||||
],
|
||||
redirectLoginUri: [
|
||||
{required: true, message: "跳转登录uri,http://localhost/login?loginId=不能为空", trigger: "blur"}
|
||||
],
|
||||
errorMsgUri: [
|
||||
{required: true, message: "错误提示uri,http://localhost/login?errorId=不能为空", trigger: "blur"}
|
||||
]
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询第三方登录平台控制列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listPlatform(this.queryParams).then(response => {
|
||||
this.platformList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
socialPlatformId: null,
|
||||
platform: null,
|
||||
status: null,
|
||||
clientId: null,
|
||||
secretKey: null,
|
||||
redirectUri: null,
|
||||
delFlag: null,
|
||||
createBy: null,
|
||||
createTime: null,
|
||||
updateTime: null,
|
||||
updateBy: null,
|
||||
remark: null,
|
||||
bindUri: null,
|
||||
redirectLoginUri: null,
|
||||
errorMsgUri: null
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.socialPlatformId)
|
||||
this.single = selection.length!==1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加第三方登录平台控制";
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const socialPlatformId = row.socialPlatformId || this.ids
|
||||
getPlatform(socialPlatformId).then(response => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改第三方登录平台控制";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.socialPlatformId != null) {
|
||||
updatePlatform(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
addPlatform(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const socialPlatformIds = row.socialPlatformId || this.ids;
|
||||
this.$modal.confirm('是否确认删除第三方登录平台控制编号为"' + socialPlatformIds + '"的数据项?').then(function() {
|
||||
return delPlatform(socialPlatformIds);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.download('iot/platform/export', {
|
||||
...this.queryParams
|
||||
}, `platform_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
@@ -39,7 +39,7 @@
|
||||
<dict-tag :options="dict.type.iot_data_type" :value="scope.row.datatype" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="数据定义" align="left" prop="specs" min-width="150" class-name="specsColor">
|
||||
<el-table-column label="数据定义" align="left" header-align="center" prop="specs" min-width="150" class-name="specsColor">
|
||||
<template slot-scope="scope">
|
||||
<div v-html="formatSpecsDisplay(scope.row.specs)"></div>
|
||||
</template>
|
||||
@@ -355,6 +355,7 @@ export default {
|
||||
this.form.datatype = "integer"
|
||||
this.form.specs = {
|
||||
enumList: [],
|
||||
arrayType: "int"
|
||||
};
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
@@ -543,8 +544,6 @@ export default {
|
||||
value: "",
|
||||
text: ""
|
||||
}];
|
||||
} else if (val == "array") {
|
||||
this.form.specs.arrayType = "int";
|
||||
}
|
||||
},
|
||||
/** 添加枚举项 */
|
||||
|
@@ -63,7 +63,7 @@
|
||||
<dict-tag :options="dict.type.iot_data_type" :value="scope.row.datatype" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="数据定义" align="left" prop="specs" min-width="150" class-name="specsColor">
|
||||
<el-table-column label="数据定义" align="left" header-align="center" prop="specs" min-width="150" class-name="specsColor">
|
||||
<template slot-scope="scope">
|
||||
<div v-html="formatSpecsDisplay(scope.row.specs)"></div>
|
||||
</template>
|
||||
@@ -75,8 +75,8 @@
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="150">
|
||||
<template slot-scope="scope">
|
||||
<el-button size="small" type="primary" style="padding:5px;" icon="el-icon-edit" @click="handleUpdate(scope.row)" v-hasPermi="['iot:template:edit']" >修改</el-button>
|
||||
<el-button size="small" type="danger" style="padding:5px;" icon="el-icon-delete" @click="handleDelete(scope.row)" v-hasPermi="['iot:template:remove']" v-if =" canEdit ? true : (scope.row.isSys == '1' ? false : true)">删除</el-button>
|
||||
<el-button size="small" type="primary" style="padding:5px;" icon="el-icon-edit" @click="handleUpdate(scope.row)" v-hasPermi="['iot:template:edit']">修改</el-button>
|
||||
<el-button size="small" type="danger" style="padding:5px;" icon="el-icon-delete" @click="handleDelete(scope.row)" v-hasPermi="['iot:template:remove']" v-if=" canEdit ? true : (scope.row.isSys == '1' ? false : true)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@@ -278,17 +278,17 @@ export default {
|
||||
this.init();
|
||||
},
|
||||
methods: {
|
||||
init(){
|
||||
if (this.$store.state.user.roles.indexOf("admin") !== -1){
|
||||
this.canEdit = true
|
||||
}
|
||||
init() {
|
||||
if (this.$store.state.user.roles.indexOf("admin") !== -1) {
|
||||
this.canEdit = true
|
||||
}
|
||||
},
|
||||
/** 查询通用物模型列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
if (this.$store.state.user.roles.indexOf("admin") === -1){
|
||||
this.queryParams.tenantName = this.$store.state.user.name
|
||||
}
|
||||
if (this.$store.state.user.roles.indexOf("admin") === -1) {
|
||||
this.queryParams.tenantName = this.$store.state.user.name
|
||||
}
|
||||
listTemplate(this.queryParams).then((response) => {
|
||||
this.templateList = response.rows;
|
||||
this.total = response.total;
|
||||
@@ -350,6 +350,7 @@ export default {
|
||||
this.form.datatype = "integer"
|
||||
this.form.specs = {
|
||||
enumList: [],
|
||||
arrayType: "int"
|
||||
};
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
@@ -377,8 +378,8 @@ export default {
|
||||
this.form.isMonitor = 0;
|
||||
this.form.isTop = 0;
|
||||
}
|
||||
// 添加通用物模型的修改者
|
||||
this.form.updateBy = this.$store.state.user.name
|
||||
// 添加通用物模型的修改者
|
||||
this.form.updateBy = this.$store.state.user.name
|
||||
updateTemplate(this.form).then((response) => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
@@ -428,15 +429,15 @@ export default {
|
||||
);
|
||||
},
|
||||
// 类型改变
|
||||
typeChange(label){
|
||||
if(label==2 || label==3){
|
||||
this.form.isMonitor=0;
|
||||
typeChange(label) {
|
||||
if (label == 2 || label == 3) {
|
||||
this.form.isMonitor = 0;
|
||||
}
|
||||
},
|
||||
// 实时监测改变
|
||||
changeMonitor(isMonitor){
|
||||
if(isMonitor==1 && this.form.datatype!="integer" && this.form.datatype!="decimal"){
|
||||
this.form.datatype="integer";
|
||||
changeMonitor(isMonitor) {
|
||||
if (isMonitor == 1 && this.form.datatype != "integer" && this.form.datatype != "decimal") {
|
||||
this.form.datatype = "integer";
|
||||
}
|
||||
},
|
||||
// 格式化物模型
|
||||
@@ -467,8 +468,6 @@ export default {
|
||||
value: "",
|
||||
text: ""
|
||||
}];
|
||||
} else if (val == "array") {
|
||||
this.form.specs.arrayType = "int";
|
||||
}
|
||||
},
|
||||
/** 添加枚举项 */
|
||||
|
@@ -1,292 +1,369 @@
|
||||
<template>
|
||||
<div class="login">
|
||||
<div class="login">
|
||||
|
||||
<div style="width:520px;padding:20px;">
|
||||
<el-row :gutter="10">
|
||||
<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
|
||||
<div class="login-top">
|
||||
<h1>物美智能 - 开源生活物联网平台</h1>
|
||||
<h2>wumei smart open source living iot platform</h2>
|
||||
<el-row :gutter="10">
|
||||
<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
|
||||
<div class="login-top">
|
||||
<h1>物美智能 - 开源生活物联网平台</h1>
|
||||
<h2>wumei smart open source living iot platform</h2>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
|
||||
<el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form" style="z-index:1000">
|
||||
<h3 class="title" v-if="!bindAccount">账号登录
|
||||
<span style="font-size:16px;color:#eee">( 演示账号:wumei<span style="margin:0 10px;">123456 )</span></span>
|
||||
</h3>
|
||||
<h3 class="bindAccountTitle" v-else>绑定物美智能账户
|
||||
</h3>
|
||||
<el-form-item prop="username">
|
||||
<el-input v-model="loginForm.username" type="text" auto-complete="off" placeholder="账号">
|
||||
<svg-icon slot="prefix" icon-class="user" class="el-input__icon input-icon"/>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="password">
|
||||
<el-input v-model="loginForm.password" type="password" auto-complete="off" placeholder="密码"
|
||||
@keyup.enter.native="handleLogin">
|
||||
<svg-icon slot="prefix" icon-class="password" class="el-input__icon input-icon"/>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="code" v-if="captchaOnOff">
|
||||
<el-input v-model="loginForm.code" auto-complete="off" placeholder="验证码" style="width: 63%"
|
||||
@keyup.enter.native="handleLogin">
|
||||
<svg-icon slot="prefix" icon-class="validCode" class="el-input__icon input-icon"/>
|
||||
</el-input>
|
||||
<div class="login-code">
|
||||
<img :src="codeUrl" @click="getCode" class="login-code-img"/>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-checkbox v-model="loginForm.rememberMe" style="margin:0px 0px 25px 0px;color:#000;">记住密码</el-checkbox>
|
||||
<el-form-item style="width:100%;">
|
||||
<el-button v-if="!bindAccount" :loading="loading" size="medium" type="primary" style="width:100%;"
|
||||
@click.native.prevent="handleLogin">
|
||||
<span v-if="!loading">登 录</span>
|
||||
<span v-else>登 录 中...</span>
|
||||
</el-button>
|
||||
<el-button v-else :loading="loading" size="medium" type="primary" style="width:100%;"
|
||||
@click.native.prevent="handleLogin">
|
||||
<span v-if="!loading">绑定</span>
|
||||
<span v-else>绑 定 中...</span>
|
||||
</el-button>
|
||||
<div style="margin-top:20px;" v-if="!bindAccount">
|
||||
<div v-if="!bindAccount" style=";text-align: center ">
|
||||
|
||||
<el-button type="success" circle title="微信登录" size="small" @click="authLogin">
|
||||
<svg-icon icon-class="wechat"/>
|
||||
</el-button>
|
||||
|
||||
<el-button type="danger" circle title="QQ登录" size="small" @click="qqLogin">
|
||||
<svg-icon icon-class="qq"/>
|
||||
</el-button>
|
||||
<el-button type="primary" circle title="支付宝登录" size="small" @click="authLogin">
|
||||
<svg-icon icon-class="zhifubao"/>
|
||||
</el-button>
|
||||
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
|
||||
<el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form" style="z-index:1000">
|
||||
<h3 class="title">账号登录
|
||||
<span style="font-size:16px;color:#eee">( 演示账号:wumei<span style="margin:0 10px;">123456 )</span></span>
|
||||
</h3>
|
||||
<el-form-item prop="username">
|
||||
<el-input v-model="loginForm.username" type="text" auto-complete="off" placeholder="账号">
|
||||
<svg-icon slot="prefix" icon-class="user" class="el-input__icon input-icon" />
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="password">
|
||||
<el-input v-model="loginForm.password" type="password" auto-complete="off" placeholder="密码" @keyup.enter.native="handleLogin">
|
||||
<svg-icon slot="prefix" icon-class="password" class="el-input__icon input-icon" />
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="code" v-if="captchaOnOff">
|
||||
<el-input v-model="loginForm.code" auto-complete="off" placeholder="验证码" style="width: 63%" @keyup.enter.native="handleLogin">
|
||||
<svg-icon slot="prefix" icon-class="validCode" class="el-input__icon input-icon" />
|
||||
</el-input>
|
||||
<div class="login-code">
|
||||
<img :src="codeUrl" @click="getCode" class="login-code-img" />
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-checkbox v-model="loginForm.rememberMe" style="margin:0px 0px 25px 0px;color:#000;">记住密码</el-checkbox>
|
||||
<el-form-item style="width:100%;">
|
||||
<el-button :loading="loading" size="medium" type="primary" style="width:100%;" @click.native.prevent="handleLogin">
|
||||
<span v-if="!loading">登 录</span>
|
||||
<span v-else>登 录 中...</span>
|
||||
</el-button>
|
||||
<div style="margin-top:10px;">
|
||||
<span style="color:#fff;margin-right:10px;">第三方登录</span>
|
||||
</div>
|
||||
<a style="margin-right:20px;color:#222" target="_blank" href="http://wumei.live">返回官网</a>
|
||||
|
||||
<el-button type="success" circle title="微信登录" size="small" @click="authLogin">
|
||||
<svg-icon icon-class="wechat" />
|
||||
</el-button>
|
||||
<div style="float: right;margin-top:10px;" v-if="register">
|
||||
|
||||
<el-button type="danger" circle title="QQ登录" size="small" @click="authLogin">
|
||||
<svg-icon icon-class="qq" />
|
||||
</el-button>
|
||||
<el-button type="primary" circle title="支付宝登录" size="small" @click="authLogin">
|
||||
<svg-icon icon-class="zhifubao"/>
|
||||
</el-button>
|
||||
</div>
|
||||
<div style="float: right;margin-top:10px;" v-if="register">
|
||||
|
||||
<a style="margin-right:20px;color:#222" target="_blank" href="http://wumei.live">返回官网</a>
|
||||
<router-link style="color:#fff;font-size:16px;" :to="'/register'">立即注册 >></router-link>
|
||||
</div>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<router-link style="color:#fff;font-size:16px;" :to='{path:"/register",query: this.$route.query }'>立即注册
|
||||
>>
|
||||
</router-link>
|
||||
</div>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
<!-- 底部 -->
|
||||
<div class="el-login-footer">
|
||||
<span>Copyright © 2018-2021 <a target="_blank" href="http://wumei.live">wumei smart</a> All Rights Reserved.</span>
|
||||
<span>Copyright © 2018-2021 <a target="_blank"
|
||||
href="http://wumei.live">wumei smart</a> All Rights Reserved.</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
getCodeImg
|
||||
getCodeImg,
|
||||
checkBindId,
|
||||
getErrorMsg
|
||||
} from "@/api/login";
|
||||
import Cookies from "js-cookie";
|
||||
import {
|
||||
encrypt,
|
||||
decrypt
|
||||
encrypt,
|
||||
decrypt
|
||||
} from '@/utils/jsencrypt'
|
||||
|
||||
export default {
|
||||
name: "Login",
|
||||
data() {
|
||||
return {
|
||||
codeUrl: "",
|
||||
loginForm: {
|
||||
username: "",
|
||||
password: "",
|
||||
rememberMe: false,
|
||||
code: "",
|
||||
uuid: ""
|
||||
},
|
||||
loginRules: {
|
||||
username: [{
|
||||
required: true,
|
||||
trigger: "blur",
|
||||
message: "请输入您的账号"
|
||||
}],
|
||||
password: [{
|
||||
required: true,
|
||||
trigger: "blur",
|
||||
message: "请输入您的密码"
|
||||
}],
|
||||
code: [{
|
||||
required: true,
|
||||
trigger: "change",
|
||||
message: "请输入验证码"
|
||||
}]
|
||||
},
|
||||
loading: false,
|
||||
// 验证码开关
|
||||
captchaOnOff: true,
|
||||
// 注册开关
|
||||
register: true,
|
||||
redirect: undefined
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
$route: {
|
||||
handler: function (route) {
|
||||
this.redirect = route.query && route.query.redirect;
|
||||
},
|
||||
immediate: true
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getCode();
|
||||
this.getCookie();
|
||||
},
|
||||
methods: {
|
||||
getCode() {
|
||||
getCodeImg().then(res => {
|
||||
this.captchaOnOff = res.captchaOnOff === undefined ? true : res.captchaOnOff;
|
||||
if (this.captchaOnOff) {
|
||||
this.codeUrl = "data:image/gif;base64," + res.img;
|
||||
this.loginForm.uuid = res.uuid;
|
||||
}
|
||||
});
|
||||
},
|
||||
getCookie() {
|
||||
const username = Cookies.get("username");
|
||||
const password = Cookies.get("password");
|
||||
const rememberMe = Cookies.get('rememberMe')
|
||||
this.loginForm = {
|
||||
username: username === undefined ? this.loginForm.username : username,
|
||||
password: password === undefined ? this.loginForm.password : decrypt(password),
|
||||
rememberMe: rememberMe === undefined ? false : Boolean(rememberMe)
|
||||
};
|
||||
},
|
||||
weixinLogin() {
|
||||
this.$alert('微信登录正在集成中...', '提示消息', {
|
||||
confirmButtonText: '确定',
|
||||
callback: action => {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: `action: ${ action }`
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
authLogin() {
|
||||
|
||||
this.$alert('第三方登录正在集成中...', '提示消息', {
|
||||
confirmButtonText: '确定',
|
||||
callback: action => {
|
||||
// this.$message({
|
||||
// type: 'info',
|
||||
// message: `action: ${ action }`
|
||||
// });
|
||||
}
|
||||
});
|
||||
},
|
||||
handleLogin() {
|
||||
this.$refs.loginForm.validate(valid => {
|
||||
if (valid) {
|
||||
this.loading = true;
|
||||
if (this.loginForm.rememberMe) {
|
||||
Cookies.set("username", this.loginForm.username, {
|
||||
expires: 30
|
||||
});
|
||||
Cookies.set("password", encrypt(this.loginForm.password), {
|
||||
expires: 30
|
||||
});
|
||||
Cookies.set('rememberMe', this.loginForm.rememberMe, {
|
||||
expires: 30
|
||||
});
|
||||
} else {
|
||||
Cookies.remove("username");
|
||||
Cookies.remove("password");
|
||||
Cookies.remove('rememberMe');
|
||||
}
|
||||
this.$store.dispatch("Login", this.loginForm).then(() => {
|
||||
this.$router.push({
|
||||
path: this.redirect || "/"
|
||||
}).catch(() => {});
|
||||
}).catch(() => {
|
||||
this.loading = false;
|
||||
if (this.captchaOnOff) {
|
||||
this.getCode();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
name: "Login",
|
||||
data() {
|
||||
return {
|
||||
codeUrl: "",
|
||||
loginForm: {
|
||||
username: "",
|
||||
password: "",
|
||||
rememberMe: false,
|
||||
code: "",
|
||||
uuid: "",
|
||||
bindId: ""
|
||||
},
|
||||
loginRules: {
|
||||
username: [{
|
||||
required: true,
|
||||
trigger: "blur",
|
||||
message: "请输入您的账号"
|
||||
}],
|
||||
password: [{
|
||||
required: true,
|
||||
trigger: "blur",
|
||||
message: "请输入您的密码"
|
||||
}],
|
||||
code: [{
|
||||
required: true,
|
||||
trigger: "change",
|
||||
message: "请输入验证码"
|
||||
}]
|
||||
},
|
||||
loading: false,
|
||||
// 验证码开关
|
||||
captchaOnOff: true,
|
||||
bindAccount: false,
|
||||
// 注册开关
|
||||
register: true,
|
||||
redirect: undefined
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
$route: {
|
||||
handler: function (route) {
|
||||
this.redirect = route.query && route.query.redirect;
|
||||
},
|
||||
immediate: true
|
||||
}
|
||||
},
|
||||
created() {
|
||||
let loginId = this.$route.query.loginId;
|
||||
if (loginId === undefined || loginId === null) {
|
||||
this.checkBind();
|
||||
this.checkErrorMsg();
|
||||
this.getCode();
|
||||
this.getCookie();
|
||||
} else {
|
||||
this.redirectLogin(loginId);
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
methods: {
|
||||
redirectLogin(loginId) {
|
||||
this.loading = true;
|
||||
this.$store.dispatch("RedirectLogin", loginId).then(() => {
|
||||
this.$router.push({
|
||||
path: this.redirect || "/"
|
||||
}).catch(() => {
|
||||
});
|
||||
}).catch(() => {
|
||||
this.loading = false;
|
||||
if (this.captchaOnOff) {
|
||||
this.getCode();
|
||||
}
|
||||
this.$router.push({
|
||||
query: {}
|
||||
})
|
||||
});
|
||||
},
|
||||
checkBind() {
|
||||
let query = this.$route.query;
|
||||
let bindId = query.bindId;
|
||||
if (bindId === undefined || bindId === null) {
|
||||
this.bindAccount = false;
|
||||
} else {
|
||||
this.bindAccount = true;
|
||||
checkBindId(bindId).then(res => {
|
||||
this.bindAccount = res.bindAccount === undefined ? true : res.bindAccount
|
||||
if (this.bindAccount) {
|
||||
this.loginForm.bindId = bindId;
|
||||
} else {
|
||||
this.loginForm.bindId = "";
|
||||
this.$router.push({
|
||||
query: {}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
checkErrorMsg() {
|
||||
let errorId = this.$route.query.errorId;
|
||||
if (errorId !== undefined && errorId !== null) {
|
||||
getErrorMsg(errorId).then(res => {
|
||||
}).catch(err => {
|
||||
this.$router.push({
|
||||
query: {}
|
||||
})
|
||||
})
|
||||
}
|
||||
},
|
||||
getCode() {
|
||||
getCodeImg().then(res => {
|
||||
this.captchaOnOff = res.captchaOnOff === undefined ? true : res.captchaOnOff;
|
||||
if (this.captchaOnOff) {
|
||||
this.codeUrl = "data:image/gif;base64," + res.img;
|
||||
this.loginForm.uuid = res.uuid;
|
||||
}
|
||||
});
|
||||
},
|
||||
getCookie() {
|
||||
const username = Cookies.get("username");
|
||||
const password = Cookies.get("password");
|
||||
const rememberMe = Cookies.get('rememberMe')
|
||||
this.loginForm = {
|
||||
username: username === undefined ? this.loginForm.username : username,
|
||||
password: password === undefined ? this.loginForm.password : decrypt(password),
|
||||
rememberMe: rememberMe === undefined ? false : Boolean(rememberMe)
|
||||
};
|
||||
},
|
||||
qqLogin() {
|
||||
window.location.href = "http://localhost:8080/auth/render/qq";
|
||||
},
|
||||
authLogin() {
|
||||
this.$alert('第三方登录正在集成中...', '提示消息', {
|
||||
confirmButtonText: '确定',
|
||||
callback: action => {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: `action: ${action}`
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
handleLogin() {
|
||||
this.$refs.loginForm.validate(valid => {
|
||||
if (valid) {
|
||||
this.loading = true;
|
||||
if (this.loginForm.rememberMe) {
|
||||
Cookies.set("username", this.loginForm.username, {
|
||||
expires: 30
|
||||
});
|
||||
Cookies.set("password", encrypt(this.loginForm.password), {
|
||||
expires: 30
|
||||
});
|
||||
Cookies.set('rememberMe', this.loginForm.rememberMe, {
|
||||
expires: 30
|
||||
});
|
||||
} else {
|
||||
Cookies.remove("username");
|
||||
Cookies.remove("password");
|
||||
Cookies.remove('rememberMe');
|
||||
}
|
||||
console.log(this.loginForm)
|
||||
this.$store.dispatch("Login", this.loginForm).then(() => {
|
||||
this.$router.push({
|
||||
path: this.redirect || "/"
|
||||
}).catch(() => {
|
||||
});
|
||||
}).catch(() => {
|
||||
this.loading = false;
|
||||
if (this.captchaOnOff) {
|
||||
this.getCode();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.login {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
background: linear-gradient(303deg, #48c6ef 10%, #6f86d6 80%);
|
||||
height: 100%;
|
||||
overflow: auto;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
background: linear-gradient(303deg, #48c6ef 10%, #6f86d6 80%);
|
||||
height: 100%;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.title {
|
||||
margin: 0px auto 30px auto;
|
||||
text-align: left;
|
||||
color: #333;
|
||||
font-size: 24px;
|
||||
margin: 0px auto 30px auto;
|
||||
text-align: left;
|
||||
color: #333;
|
||||
font-size: 24px;
|
||||
}
|
||||
|
||||
.bindAccountTitle {
|
||||
margin: 0px auto 30px auto;
|
||||
text-align: center;
|
||||
color: #333;
|
||||
font-size: 24px;
|
||||
}
|
||||
|
||||
.login-top {
|
||||
color: #fff;
|
||||
text-align: center;
|
||||
font-weight: bold;
|
||||
margin-top: 100px;
|
||||
color: #fff;
|
||||
text-align: center;
|
||||
font-weight: bold;
|
||||
margin-top: 100px;
|
||||
|
||||
h1 {
|
||||
font-size: 30px;
|
||||
}
|
||||
h1 {
|
||||
font-size: 30px;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 21px;
|
||||
margin-top: -12px;
|
||||
}
|
||||
h2 {
|
||||
font-size: 21px;
|
||||
margin-top: -12px;
|
||||
}
|
||||
}
|
||||
|
||||
.login-form {
|
||||
border-radius: 6px;
|
||||
background-color: rgba(250, 250, 250, 0.2);
|
||||
border: 1px solid #fff;
|
||||
padding: 25px 25px 5px 25px;
|
||||
margin: 20px;
|
||||
margin-bottom: 100px;
|
||||
border-radius: 6px;
|
||||
background-color: rgba(250, 250, 250, 0.2);
|
||||
border: 1px solid #fff;
|
||||
padding: 25px 25px 5px 25px;
|
||||
margin: 20px;
|
||||
margin-bottom: 100px;
|
||||
|
||||
.el-input {
|
||||
height: 38px;
|
||||
.el-input {
|
||||
height: 38px;
|
||||
|
||||
input {
|
||||
height: 38px;
|
||||
}
|
||||
input {
|
||||
height: 38px;
|
||||
}
|
||||
}
|
||||
|
||||
.input-icon {
|
||||
height: 39px;
|
||||
width: 14px;
|
||||
margin-left: 2px;
|
||||
}
|
||||
.input-icon {
|
||||
height: 39px;
|
||||
width: 14px;
|
||||
margin-left: 2px;
|
||||
}
|
||||
}
|
||||
|
||||
.login-code {
|
||||
width: 33%;
|
||||
height: 38px;
|
||||
float: right;
|
||||
width: 33%;
|
||||
height: 38px;
|
||||
float: right;
|
||||
|
||||
img {
|
||||
cursor: pointer;
|
||||
vertical-align: middle;
|
||||
}
|
||||
img {
|
||||
cursor: pointer;
|
||||
vertical-align: middle;
|
||||
}
|
||||
}
|
||||
|
||||
.el-login-footer {
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
color: #fff;
|
||||
font-family: Arial;
|
||||
font-size: 12px;
|
||||
letter-spacing: 1px;
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
color: #fff;
|
||||
font-family: Arial;
|
||||
font-size: 12px;
|
||||
letter-spacing: 1px;
|
||||
}
|
||||
|
||||
.login-code-img {
|
||||
height: 38px;
|
||||
height: 38px;
|
||||
}
|
||||
</style>
|
||||
|
@@ -1,270 +1,360 @@
|
||||
<template>
|
||||
<div class="register">
|
||||
<div class="register">
|
||||
|
||||
<div style="width:520px;padding:20px;">
|
||||
<el-row :gutter="10">
|
||||
<div style="width:520px;padding:20px;">
|
||||
<el-row :gutter="10">
|
||||
<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
|
||||
<div class="login-top">
|
||||
<h1>物美智能 - 开源生活物联网平台</h1>
|
||||
<h2>wumei smart open source living iot platform</h2>
|
||||
</div>
|
||||
<div class="login-top">
|
||||
<h1>物美智能 - 开源生活物联网平台</h1>
|
||||
<h2>wumei smart open source living iot platform</h2>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
|
||||
<el-form ref="registerForm" :model="registerForm" :rules="registerRules" class="register-form" style="z-index:1000">
|
||||
<h3 class="title">注册账号</h3>
|
||||
<el-form-item prop="username">
|
||||
<el-input v-model="registerForm.username" type="text" auto-complete="off" placeholder="账号">
|
||||
<svg-icon slot="prefix" icon-class="user" class="el-input__icon input-icon" />
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="phonenumber">
|
||||
<el-input v-model="registerForm.phonenumber" type="text" auto-complete="off" placeholder="手机号码">
|
||||
<svg-icon slot="prefix" icon-class="phone" class="el-input__icon input-icon" />
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="password">
|
||||
<el-input v-model="registerForm.password" type="password" auto-complete="off" placeholder="密码" @keyup.enter.native="handleRegister">
|
||||
<svg-icon slot="prefix" icon-class="password" class="el-input__icon input-icon" />
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="confirmPassword">
|
||||
<el-input v-model="registerForm.confirmPassword" type="password" auto-complete="off" placeholder="确认密码" @keyup.enter.native="handleRegister">
|
||||
<svg-icon slot="prefix" icon-class="password" class="el-input__icon input-icon" />
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="code" v-if="captchaOnOff">
|
||||
<el-input v-model="registerForm.code" auto-complete="off" placeholder="验证码" style="width: 63%" @keyup.enter.native="handleRegister">
|
||||
<svg-icon slot="prefix" icon-class="validCode" class="el-input__icon input-icon" />
|
||||
</el-input>
|
||||
<div class="register-code">
|
||||
<img :src="codeUrl" @click="getCode" class="register-code-img" />
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item style="width:100%;">
|
||||
<el-button :loading="loading" size="medium" type="primary" style="width:100%;" @click.native.prevent="handleRegister">
|
||||
<span v-if="!loading">注 册</span>
|
||||
<span v-else>注 册 中...</span>
|
||||
</el-button>
|
||||
<div style="float: right;margin-top:10px;">
|
||||
<a style="margin-right:20px;" target="_blank" href="http://wumei.live">返回官网</a>
|
||||
<router-link style="color:#fff;font-size:16px;" :to="'/login'">使用已有账户登录 >> </router-link>
|
||||
</div>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-form ref="registerForm" :model="registerForm" :rules="registerRules" class="register-form"
|
||||
style="z-index:1000">
|
||||
<h3 class="title" v-if="!bindAccount">注册账号</h3>
|
||||
<h3 class="title" v-else>注册绑定物美智能账户</h3>
|
||||
<el-form-item prop="username">
|
||||
<el-input v-model="registerForm.username" type="text" auto-complete="off" placeholder="账号">
|
||||
<svg-icon slot="prefix" icon-class="user" class="el-input__icon input-icon"/>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="phonenumber">
|
||||
<el-input v-model="registerForm.phonenumber" type="text" auto-complete="off" placeholder="手机号码">
|
||||
<svg-icon slot="prefix" icon-class="phone" class="el-input__icon input-icon"/>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="password">
|
||||
<el-input v-model="registerForm.password" type="password" auto-complete="off" placeholder="密码"
|
||||
@keyup.enter.native="handleRegister">
|
||||
<svg-icon slot="prefix" icon-class="password" class="el-input__icon input-icon"/>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="confirmPassword">
|
||||
<el-input v-model="registerForm.confirmPassword" type="password" auto-complete="off" placeholder="确认密码"
|
||||
@keyup.enter.native="handleRegister">
|
||||
<svg-icon slot="prefix" icon-class="password" class="el-input__icon input-icon"/>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="code" v-if="captchaOnOff">
|
||||
<el-input v-model="registerForm.code" auto-complete="off" placeholder="验证码" style="width: 63%"
|
||||
@keyup.enter.native="handleRegister">
|
||||
<svg-icon slot="prefix" icon-class="validCode" class="el-input__icon input-icon"/>
|
||||
</el-input>
|
||||
<div class="register-code">
|
||||
<img :src="codeUrl" @click="getCode" class="register-code-img"/>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item style="width:100%;">
|
||||
<el-button v-if="!bindAccount" :loading="loading" size="medium" type="primary" style="width:100%;"
|
||||
@click.native.prevent="handleRegister">
|
||||
<span v-if="!loading">注 册</span>
|
||||
<span v-else>注 册 中...</span>
|
||||
</el-button>
|
||||
<el-button v-else :loading="loading" size="medium" type="primary" style="width:100%;"
|
||||
@click.native.prevent="handleRegister">
|
||||
<span v-if="!loading">绑 定</span>
|
||||
<span v-else>绑 定 中...</span>
|
||||
</el-button>
|
||||
<div style="margin-top:20px;">
|
||||
|
||||
<div v-if="!bindAccount" style=" margin-bottom: 10px;text-align: center ">
|
||||
<!-- <span style="color:#fff;margin-right:10px; float: left">快速登录</span>-->
|
||||
|
||||
<el-button type="success" circle title="微信登录" size="small" @click="authLogin">
|
||||
<svg-icon icon-class="wechat"/>
|
||||
</el-button>
|
||||
|
||||
<el-button type="danger" circle title="QQ登录" size="small" @click="qqLogin">
|
||||
<svg-icon icon-class="qq"/>
|
||||
</el-button>
|
||||
<el-button type="primary" circle title="支付宝登录" size="small" @click="authLogin">
|
||||
<svg-icon icon-class="zhifubao"/>
|
||||
</el-button>
|
||||
|
||||
|
||||
</div>
|
||||
<router-link style="float:left;color:#fff;font-size:16px;"
|
||||
:to='{path:"/login",query: this.$route.query }'>使用已有账户登录 >>
|
||||
</router-link>
|
||||
|
||||
<div style="float: right">
|
||||
<a style="margin-right:20px;" target="_blank" href="http://wumei.live">返回官网</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-col>
|
||||
|
||||
</el-row>
|
||||
</div>
|
||||
</el-row>
|
||||
</div>
|
||||
<!-- 底部 -->
|
||||
<div class="el-register-footer">
|
||||
<span>Copyright © 2018-2021 <a target="_blank" href="http://wumei.live">wumei smart</a> All Rights Reserved.</span>
|
||||
<span>Copyright © 2018-2021 <a target="_blank"
|
||||
href="http://wumei.live">wumei smart</a> All Rights Reserved.</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
getCodeImg
|
||||
getCodeImg, checkBindId, bindRegister
|
||||
} from "@/api/login";
|
||||
import {
|
||||
register
|
||||
register
|
||||
} from '@/api/iot/tool';
|
||||
|
||||
export default {
|
||||
name: "Register",
|
||||
data() {
|
||||
const equalToPassword = (rule, value, callback) => {
|
||||
if (this.registerForm.password !== value) {
|
||||
callback(new Error("两次输入的密码不一致"));
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
};
|
||||
return {
|
||||
codeUrl: "",
|
||||
registerForm: {
|
||||
username: "",
|
||||
phonenumber: "",
|
||||
password: "",
|
||||
confirmPassword: "",
|
||||
code: "",
|
||||
uuid: ""
|
||||
},
|
||||
registerRules: {
|
||||
username: [{
|
||||
required: true,
|
||||
trigger: "blur",
|
||||
message: "请输入您的账号"
|
||||
},
|
||||
{
|
||||
min: 2,
|
||||
max: 20,
|
||||
message: '用户账号长度必须介于 2 和 20 之间',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
phonenumber: [{
|
||||
required: true,
|
||||
trigger: "blur",
|
||||
message: "请输入您的手机号码"
|
||||
},
|
||||
{
|
||||
min: 11,
|
||||
max: 11,
|
||||
message: '手机号码长度为11',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
password: [{
|
||||
required: true,
|
||||
trigger: "blur",
|
||||
message: "请输入您的密码"
|
||||
},
|
||||
{
|
||||
min: 5,
|
||||
max: 20,
|
||||
message: '用户密码长度必须介于 5 和 20 之间',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
confirmPassword: [{
|
||||
required: true,
|
||||
trigger: "blur",
|
||||
message: "请再次输入您的密码"
|
||||
},
|
||||
{
|
||||
required: true,
|
||||
validator: equalToPassword,
|
||||
trigger: "blur"
|
||||
}
|
||||
],
|
||||
code: [{
|
||||
required: true,
|
||||
trigger: "change",
|
||||
message: "请输入验证码"
|
||||
}]
|
||||
},
|
||||
loading: false,
|
||||
captchaOnOff: true
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getCode();
|
||||
},
|
||||
methods: {
|
||||
getCode() {
|
||||
getCodeImg().then(res => {
|
||||
this.captchaOnOff = res.captchaOnOff === undefined ? true : res.captchaOnOff;
|
||||
if (this.captchaOnOff) {
|
||||
this.codeUrl = "data:image/gif;base64," + res.img;
|
||||
this.registerForm.uuid = res.uuid;
|
||||
}
|
||||
});
|
||||
name: "Register",
|
||||
data() {
|
||||
const equalToPassword = (rule, value, callback) => {
|
||||
if (this.registerForm.password !== value) {
|
||||
callback(new Error("两次输入的密码不一致"));
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
};
|
||||
return {
|
||||
codeUrl: "",
|
||||
registerForm: {
|
||||
username: "",
|
||||
phonenumber: "",
|
||||
password: "",
|
||||
confirmPassword: "",
|
||||
code: "",
|
||||
uuid: "",
|
||||
bindId: ""
|
||||
},
|
||||
registerRules: {
|
||||
username: [{
|
||||
required: true,
|
||||
trigger: "blur",
|
||||
message: "请输入您的账号"
|
||||
},
|
||||
handleRegister() {
|
||||
this.$refs.registerForm.validate(valid => {
|
||||
if (valid) {
|
||||
this.loading = true;
|
||||
register(this.registerForm).then(res => {
|
||||
const username = this.registerForm.username;
|
||||
this.$alert("<font color='red'>恭喜你,您的账号 " + username + " 注册成功!</font>", '系统提示', {
|
||||
dangerouslyUseHTMLString: true,
|
||||
type: 'success'
|
||||
}).then(() => {
|
||||
this.$router.push("/login");
|
||||
}).catch(() => {});
|
||||
}).catch(() => {
|
||||
this.loading = false;
|
||||
if (this.captchaOnOff) {
|
||||
this.getCode();
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
||||
{
|
||||
min: 2,
|
||||
max: 20,
|
||||
message: '用户账号长度必须介于 2 和 20 之间',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
phonenumber: [{
|
||||
required: true,
|
||||
trigger: "blur",
|
||||
message: "请输入您的手机号码"
|
||||
},
|
||||
{
|
||||
min: 11,
|
||||
max: 11,
|
||||
message: '手机号码长度为11',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
password: [{
|
||||
required: true,
|
||||
trigger: "blur",
|
||||
message: "请输入您的密码"
|
||||
},
|
||||
{
|
||||
min: 5,
|
||||
max: 20,
|
||||
message: '用户密码长度必须介于 5 和 20 之间',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
confirmPassword: [{
|
||||
required: true,
|
||||
trigger: "blur",
|
||||
message: "请再次输入您的密码"
|
||||
},
|
||||
{
|
||||
required: true,
|
||||
validator: equalToPassword,
|
||||
trigger: "blur"
|
||||
}
|
||||
],
|
||||
code: [{
|
||||
required: true,
|
||||
trigger: "change",
|
||||
message: "请输入验证码"
|
||||
}]
|
||||
},
|
||||
loading: false,
|
||||
captchaOnOff: true,
|
||||
bindAccount: false
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.checkBind();
|
||||
this.getCode();
|
||||
},
|
||||
methods: {
|
||||
checkBind() {
|
||||
let query = this.$route.query;
|
||||
let bindId = query.bindId;
|
||||
if (bindId === undefined || bindId === null) {
|
||||
this.bindAccount = false;
|
||||
} else {
|
||||
this.bindAccount = true;
|
||||
checkBindId(bindId).then(res => {
|
||||
this.bindAccount = res.bindAccount === undefined ? true : res.bindAccount
|
||||
if (this.bindAccount) {
|
||||
this.registerForm.bindId = bindId;
|
||||
} else {
|
||||
this.registerForm.bindId = "";
|
||||
this.$router.push({
|
||||
query: {}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
getCode() {
|
||||
getCodeImg().then(res => {
|
||||
this.captchaOnOff = res.captchaOnOff === undefined ? true : res.captchaOnOff;
|
||||
if (this.captchaOnOff) {
|
||||
this.codeUrl = "data:image/gif;base64," + res.img;
|
||||
this.registerForm.uuid = res.uuid;
|
||||
}
|
||||
});
|
||||
},
|
||||
qqLogin() {
|
||||
window.location.href = "http://localhost:8080/auth/render/qq";
|
||||
},
|
||||
authLogin() {
|
||||
this.$alert('第三方登录正在集成中...', '提示消息', {
|
||||
confirmButtonText: '确定',
|
||||
callback: action => {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: `action: ${action}`
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
handleRegister() {
|
||||
this.$refs.registerForm.validate(valid => {
|
||||
if (valid) {
|
||||
this.loading = true;
|
||||
if (this.bindAccount) {
|
||||
bindRegister(this.registerForm).then(res => {
|
||||
this.innerRegister(res)
|
||||
}).catch(() => {
|
||||
this.loading = false;
|
||||
if (this.captchaOnOff) {
|
||||
this.getCode();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
register(this.registerForm).then(res => {
|
||||
this.innerRegister(res)
|
||||
}).catch(() => {
|
||||
this.loading = false;
|
||||
if (this.captchaOnOff) {
|
||||
this.getCode();
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
innerRegister(res) {
|
||||
const username = this.registerForm.username;
|
||||
this.$alert("<font color='red'>恭喜你,您的账号 " + username + " 注册成功!</font>", '系统提示', {
|
||||
dangerouslyUseHTMLString: true,
|
||||
type: 'success'
|
||||
}).then(() => {
|
||||
this.$router.push("/login");
|
||||
}).catch(() => {
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.register {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
height: 100%;
|
||||
background: linear-gradient(303deg, #48c6ef 10%, #6f86d6 80%);
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
height: 100%;
|
||||
background: linear-gradient(303deg, #48c6ef 10%, #6f86d6 80%);
|
||||
}
|
||||
|
||||
.login-top {
|
||||
color: #fff;
|
||||
text-align: center;
|
||||
font-weight: bold;
|
||||
margin-top: 100px;
|
||||
color: #fff;
|
||||
text-align: center;
|
||||
font-weight: bold;
|
||||
margin-top: 100px;
|
||||
|
||||
h1 {
|
||||
font-size: 30px;
|
||||
}
|
||||
h1 {
|
||||
font-size: 30px;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 21px;
|
||||
margin-top: -12px;
|
||||
}
|
||||
h2 {
|
||||
font-size: 21px;
|
||||
margin-top: -12px;
|
||||
}
|
||||
}
|
||||
|
||||
.title {
|
||||
margin: 0px auto 30px auto;
|
||||
text-align: center;
|
||||
color: #333;
|
||||
font-size:24px;
|
||||
margin: 0px auto 30px auto;
|
||||
text-align: center;
|
||||
color: #333;
|
||||
font-size: 24px;
|
||||
}
|
||||
|
||||
.register-form {
|
||||
border-radius: 6px;
|
||||
background: #ffffff;
|
||||
background-color: rgba(250, 250, 250, 0.2);
|
||||
border: 1px solid #fff;
|
||||
padding: 25px 25px 5px 25px;
|
||||
margin:20px;
|
||||
border-radius: 6px;
|
||||
background: #ffffff;
|
||||
background-color: rgba(250, 250, 250, 0.2);
|
||||
border: 1px solid #fff;
|
||||
padding: 25px 25px 5px 25px;
|
||||
margin: 20px;
|
||||
|
||||
.el-input {
|
||||
height: 38px;
|
||||
.el-input {
|
||||
height: 38px;
|
||||
|
||||
input {
|
||||
height: 38px;
|
||||
}
|
||||
input {
|
||||
height: 38px;
|
||||
}
|
||||
}
|
||||
|
||||
.input-icon {
|
||||
height: 39px;
|
||||
width: 14px;
|
||||
margin-left: 2px;
|
||||
}
|
||||
.input-icon {
|
||||
height: 39px;
|
||||
width: 14px;
|
||||
margin-left: 2px;
|
||||
}
|
||||
}
|
||||
|
||||
.register-code {
|
||||
width: 33%;
|
||||
height: 38px;
|
||||
float: right;
|
||||
width: 33%;
|
||||
height: 38px;
|
||||
float: right;
|
||||
|
||||
img {
|
||||
cursor: pointer;
|
||||
vertical-align: middle;
|
||||
}
|
||||
img {
|
||||
cursor: pointer;
|
||||
vertical-align: middle;
|
||||
}
|
||||
}
|
||||
|
||||
.el-register-footer {
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
color: #fff;
|
||||
font-family: Arial;
|
||||
font-size: 12px;
|
||||
letter-spacing: 1px;
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
color: #fff;
|
||||
font-family: Arial;
|
||||
font-size: 12px;
|
||||
letter-spacing: 1px;
|
||||
}
|
||||
|
||||
.register-code-img {
|
||||
height: 38px;
|
||||
height: 38px;
|
||||
}
|
||||
</style>
|
||||
|
Reference in New Issue
Block a user