Commit bdc94ec4 by Xingbz

补充 pre环境

parent d6459eae
......@@ -8,6 +8,7 @@
// @author mobvista
// @require https://cdn.jsdelivr.net/npm/js-cookie@3.0.5/dist/js.cookie.min.js
// @require https://cdn.jsdelivr.net/npm/watermark-package@2.1.2/dist/watermark.umd.min.js
// @require https://cdn.jsdelivr.net/npm/sweetalert@2.1.2/dist/sweetalert.min.js
// @description 2023/12/6 13:42:17
// ==/UserScript==
// noinspection JSUnresolvedReference
......@@ -46,7 +47,7 @@ let logoutTimerId
// 已登录
if (Cookies.get(CN(K_USER))) {
L('匹配到模登用户, 准备添加监控. K_USER: ' + Cookies.get(CN(K_USER)))
watermarkTimerId = setInterval( addWatermark, 1000)
watermarkTimerId = setInterval(addWatermark, 1000)
// 添加登出监控
logoutTimerId = setInterval(addLogoutListener, 500)
// 添加请求监控
......@@ -84,9 +85,9 @@ function addWatermark() {
{
w_texts: ['模拟环境[' + Cookies.get(CN(K_USER)) + ']' + getNowTime()],
w_options: {
w_width: 310,
w_height: 160,
w_opacity: '0.21'
w_width: 380,
w_height: 180,
w_opacity: '0.2'
}
}
)
......@@ -145,12 +146,26 @@ function addRequestListener() {
"responseBody": xhr.response
}
sendLog(param)
warning(requestUrl)
}
}
}
})
}
function warning(url) {
L("url:" + url)
if (url.endsWith('delete') || url.endsWith('remove') || url.endsWith('edit') || url.endsWith('update')) {
swal({
title: "警告: 删除/更新操作",
text: url,
icon: "warning",
button: false,
timer: 2000
})
}
}
// 发送日志
function sendLog(param) {
const httpRequest = new XMLHttpRequest();
......@@ -199,8 +214,8 @@ function getNowTime() {
h = h < 10 ? '0' + h : h
m = m < 10 ? '0' + m : m
s = s < 10 ? '0' + s : s
// return year + "-" + month + "-" + date + " " + h + ":" + m;
return h + ":" + m + ":" + s;
return month + "-" + date + " " + h + ":" + m;
// return h + ":" + m + ":" + s;
}
function CN(name) {
......
......@@ -8,9 +8,9 @@ export function autoLogin(data) {
method: 'post',
data
}).then(res => {
const authToken = res.data
if(authToken){
var loginUrl = 'https://test2.adsdesk.cn?authToken=' + authToken;
const loginUrl = res.data
if(loginUrl){
// var loginUrl = 'https://test2.adsdesk.cn?authToken=' + authToken;
console.log(loginUrl)
//window.open('https://test2.adsdesk.cn/login?authToken=' + authToken)
window.open(loginUrl, '__blank')
......
......@@ -2,17 +2,38 @@
<div class="app-container">
<el-form :model="queryParams" ref="queryRef" :inline="true">
<el-form-item label="平台" prop="outApp">
<el-select
v-model="queryParams.outApp"
placeholder="请选择平台"
clearable
style="width: 160px"
>
<el-option
label="AdsDesk"
value=".adsdesk.cn"
/>
</el-select>
</el-form-item>
<el-form-item label="环境" prop="outEnv">
<el-select
v-model="queryParams.outEnv"
placeholder="请选择环境"
clearable
style="width: 160px"
>
<el-option
label="测试环境"
value="test2"
/>
<el-option
label="灰度环境"
value="pre"
/>
</el-select>
</el-form-item>
<el-form-item prop="userId">
<template #label>
<!--<el-tooltip
content="支持多个查询(,隔开)"
placement="top"
raw-content
>
<el-icon style="top: 2px;">
<question-filled/>
</el-icon>
</el-tooltip>-->
用户编号
</template>
<el-input
......@@ -41,31 +62,6 @@
@keyup.enter="handleQuery"
/>
</el-form-item>
<!--<el-form-item label="用户角色" prop="role">
<el-select
v-model="queryParams.role"
placeholder="请选择用户角色"
clearable
style="width: 160px"
>
<el-option
v-for="dict in ads_user_role"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>-->
<!--<el-form-item label="创建时间" style="width: 280px">
<el-date-picker
v-model="createDateRange"
value-format="YYYY-MM-DD"
type="daterange"
range-separator="-"
start-placeholder="开始日期"
end-placeholder="结束日期"
></el-date-picker>
</el-form-item>-->
<el-form-item>
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
......@@ -140,8 +136,6 @@
<script setup name="AdsUser">
import {ref, reactive} from "vue";
//客户详情
// import CustomerDetailDialog from "@/components/adsdesk/CustomerDetailDialog"
//用户列表
import {listUser} from "@/api/adsdesk/user/user";
//
......@@ -160,6 +154,8 @@ const customerId = ref(0);
const queryParams = reactive({
pageNum: 1,
pageSize: 10,
outApp:'.adsdesk.cn',
outEnv:'test2',
customerType: null,
ids: null,
customerName: null,
......@@ -167,6 +163,9 @@ const queryParams = reactive({
})
function getList() {
if(!queryParams.outApp || !queryParams.outEnv) {
return proxy.$modal.alertError("请选择平台和环境");
}
loading.value = true;
listUser(queryParams).then(res => {
userList.value = res.rows
......@@ -195,18 +194,14 @@ function handleSortChange(column, prop, order) {
getList();
}
function handleCustomerDetail(id) {
if (id <= 0) {
return proxy.$modal.alertError("客户编号不正确: " + id);
}
customerId.value = id
showCustomerDetail.value = true;
}
function handleSimulateLogin(row) {
const {userName, userNick,userId} = row
proxy.$modal.confirm('您将使用指定用户[' + userNick + '(' + userName + ')]模拟登录系统查看数据. 谨记不要进行修改提交等影响数据的操作!').then(function () {
autoLogin({userId,userName,userNick})
autoLogin({
outApp: queryParams.outApp,
outEnv: queryParams.outEnv,
userId, userName, userNick})
})
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment