下载中心_软件下载_资料下载_帮助文档下载_其他下载.ts-search-box .search-content {
width: 178px;
height: 34px;
}
.ts-search-box .search-btn {
top: 48px;
}
.reco:hover {
color: #3bb5ff;
}
.download-icon {
width: 18px;
height: 18px;
margin-right: 5px;
}
.page-box {
padding-top: 0;
}
.el-table .warning-row {
background: oldlace;
}
.el-table .success-row {
background: #f0f9eb;
}
.el-carousel__container{
height: 420px;
}
.regisers{
color: #2b9dff;
}
.regisers:hover{
cursor: pointer;
color: #155bff;
}
.el-menu--horizontal>.el-submenu.is-active .el-submenu__title{
border: none;
height: 80px;
line-height: 80px;
}
.el-menu.el-menu--horizontal{
border:none;
}
.tab{
width: 80px;
height: 40px;
background-color: #F3F5F7;
float: left;
margin-right: 10px;
margin-bottom: 10px;
text-align: center;
line-height: 40px;
font-size: 14px;
color: #8D8D8D;
}
:title="title"
:visible.sync="loginDialogVisible"
:close-on-click-modal="false"
width="400px"
center>
去注册
去登录
取 消
{{loading?'登录中':'登录'}}
取 消
{{loading?'注册中':'注册'}}
:data="fileData"
v-loading="loadingTable"
style="width: 100%;height: 100%"
>
prop="title"
label="文件名"
align="center"
>
prop="size"
label="大小"
align="center"
>
prop="created_at"
label="上传时间"
align="center"
>
label="下载"
align="center"
>
下载
var validatePass = (rule, value, callback) => {
if (value === '') {
callback(new Error('请输入密码'));
} else {
var r = /^[^\u4e00-\u9fa5]+$/
if(!r.test(value)){
callback(new Error('密码不能为中文!'));
}
if (value.length < 6 ) {
callback(new Error('密码长度在 6 到 18 个字符!'));
}
callback();
}
};
var phoneValid = (rule, value, callback) => {
let phoneReg = /^(13[0-9]|14[579]|15[0-3,5-9]|16[6]|17[0135678]|18[0-9]|19[89])\d{8}$/
if (!value) {
callback(new Error('请输入手机号码'))
}
if (!phoneReg.test(value)) {
callback(new Error('请输入正确的手机号码'))
}
callback()
};
new Vue({
el: '#app',
data: {
title:'',
form: {
phone:'',
password:''
},
rules: {
phone: [
{ validator: phoneValid, trigger: 'change' }
],
password: [
{ validator: validatePass, trigger: 'change' }
]
},
isLogin:false,
loading:false,
loadingTable:false,
loginDialogVisible:false,
fileData: [],
contentData: [],
headData: [],
shareData: [],
shenData: [],
caishuiData: [],
token: '',
userPhone:'',
userInfo:{},
fileHttp: 'http://xiaopengbest.cn/api/common/file?type=',
loginHttp: 'http://xiaopengbest.cn/api/user/session',
},
watch: {
loginDialogVisible:function (val) {
if (!val) {
Object.keys(this.form).forEach(key => this.form[key] = '');
this.$refs['form'].resetFields();
}
},
isLogin:function (val) {
if (val) {
this.title='登录';
} else{
this.title='注册';
}
}
},
created() {
this.fileHttp = this.fileHttp + this.GetRequest('id');
this.token = localStorage.getItem('token');
if(this.token){
this.token =(this.token.replace('"',''));
}
this.userPhone = localStorage.getItem('userInfo')?JSON.parse(localStorage.getItem('userInfo')).phone:'';
this.userInfo = localStorage.getItem('userInfo')?JSON.parse(localStorage.getItem('userInfo')):'';
this.getBannerList();
},
methods: {
loginOut() {
localStorage.clear();
// window.location.href = 'http://xiaopengbest.cn/index.html';
window.location.reload();
},
downLoad(val) {
if (this.token) {
window.open(val);
} else {
this.title='登录';
this.isLogin = true;
this.loginDialogVisible = true;
}
},
GetRequest(value) {
let url = decodeURI(location.search);
let object = {};
if(url.indexOf("?") != -1)
{
let str = url.substr(1);
let strs = str.split("&");
for(let i = 0; i < strs.length; i ++)
{
object[strs[i].split("=")[0]]=strs[i].split("=")[1]
}
}
return object[value];
},
showLogin() {
this.title='登录';
this.isLogin = true;
this.loginDialogVisible = true;
},
showRegister() {
this.title='注册';
this.isLogin = false;
this.loginDialogVisible = true;
},
submitCostomer(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
if (this.isLogin){
this.toLogin();
} else {
this.toRegister();
}
} else {
return false;
}
});
},
toLogin() {
this.loading = true;
axios.post(this.loginHttp, {
phone: this.form.phone,
password:this.form.password
}).then((res) => {
if (res.data.code == 200) {
this.loading = false;
this.$message({
type:'success',
message:'登录成功',
duration:1000
});
this.loginDialogVisible = false;
this.userPhone = res.data.data.phone;
localStorage.setItem('userInfo', JSON.stringify(res.data.data));
localStorage.setItem('token', JSON.stringify(res.data.data.api_token));
window.location.reload();
}
}).catch((err)=> {
this.loading = false;
this.$message.warning(err.response.data.msg || "数据异常,请重试");
});
},
toRegister() {
this.loading = true;
axios.post(this.registerHttp, {
phone: this.form.phone,
password:this.form.password
}).then((res) => {
if (res.data.code == 200) {
this.loading = false;
this.$message({
type:'success',
message:'注册成功,去登陆',
duration:1000
});
this.isLogin = true;
}
}).catch((err)=> {
this.loading = false;
this.$message.warning(err.response.data.msg || "数据异常,请重试");
});
},
tableRowClassName({row, rowIndex}) {
if (rowIndex === 1) {
return 'warning-row';
} else if (rowIndex === 3) {
return 'success-row';
}
return '';
},
getBannerList() {
const self = this;
self.loadingTable = true;
axios.get(this.fileHttp, {
headers: {
"Content-Type": "application/x-www-form-urlencoded;charset=utf-8",
'Authorization': 'Bearer ' + this.token,
}
}
)
.then(function (res) {
self.loadingTable = false;
self.fileData = res.data.data;
}).catch(function (res) {
self.loadingTable = false;
console.log(res);
});
}
}
});
一键复制
编辑
Web IDE
原始数据
按行查看
历史