Commit f4156156 authored by zL's avatar zL

重构部分代码提交

parent 41b85030
...@@ -2177,6 +2177,15 @@ ...@@ -2177,6 +2177,15 @@
"integrity": "sha1-oXs6jqgRBg501H0wYSJACtRJeuI=", "integrity": "sha1-oXs6jqgRBg501H0wYSJACtRJeuI=",
"dev": true "dev": true
}, },
"axios": {
"version": "0.18.0",
"resolved": "https://registry.npmjs.org/axios/-/axios-0.18.0.tgz",
"integrity": "sha1-MtU+SFHv3AoRmTts0AB4nXDAUQI=",
"requires": {
"follow-redirects": "^1.3.0",
"is-buffer": "^1.1.5"
}
},
"babel-code-frame": { "babel-code-frame": {
"version": "6.26.0", "version": "6.26.0",
"resolved": "https://registry.npm.taobao.org/babel-code-frame/download/babel-code-frame-6.26.0.tgz", "resolved": "https://registry.npm.taobao.org/babel-code-frame/download/babel-code-frame-6.26.0.tgz",
...@@ -5021,8 +5030,7 @@ ...@@ -5021,8 +5030,7 @@
"follow-redirects": { "follow-redirects": {
"version": "1.12.1", "version": "1.12.1",
"resolved": "https://registry.npm.taobao.org/follow-redirects/download/follow-redirects-1.12.1.tgz", "resolved": "https://registry.npm.taobao.org/follow-redirects/download/follow-redirects-1.12.1.tgz",
"integrity": "sha1-3lSmIFMRuT1gOY68Ac9wFWgjErY=", "integrity": "sha1-3lSmIFMRuT1gOY68Ac9wFWgjErY="
"dev": true
}, },
"for-in": { "for-in": {
"version": "1.0.2", "version": "1.0.2",
...@@ -5875,8 +5883,7 @@ ...@@ -5875,8 +5883,7 @@
"is-buffer": { "is-buffer": {
"version": "1.1.6", "version": "1.1.6",
"resolved": "https://registry.npm.taobao.org/is-buffer/download/is-buffer-1.1.6.tgz", "resolved": "https://registry.npm.taobao.org/is-buffer/download/is-buffer-1.1.6.tgz",
"integrity": "sha1-76ouqdqg16suoTqXsritUf776L4=", "integrity": "sha1-76ouqdqg16suoTqXsritUf776L4="
"dev": true
}, },
"is-callable": { "is-callable": {
"version": "1.2.0", "version": "1.2.0",
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
"dev:refactoring": "vue-cli-service serve --mode refactoring_test" "dev:refactoring": "vue-cli-service serve --mode refactoring_test"
}, },
"dependencies": { "dependencies": {
"axios": "^0.18.0",
"core-js": "^3.6.5", "core-js": "^3.6.5",
"crypto-js": "^4.0.0", "crypto-js": "^4.0.0",
"element-ui": "^2.13.2", "element-ui": "^2.13.2",
...@@ -32,4 +33,4 @@ ...@@ -32,4 +33,4 @@
"last 2 versions", "last 2 versions",
"not dead" "not dead"
] ]
} }
\ No newline at end of file
// let UrlPrefixObj = require('./UrlPrefix'); let UrlPrefixObj = require('./UrlPrefix');
// export const CHAIN_BROWSER_URL = UrlPrefixObj.model.CHAIN_BROWSER_URL_PREFIX + 'product?hash='; export const CHAIN_BROWSER_URL = UrlPrefixObj.model.CHAIN_BROWSER_URL_PREFIX + 'product?hash=';
// let prefix = UrlPrefixObj.model.INERFACE_URL_PREFIX + "/v1/"; let prefix_go = UrlPrefixObj.model.INERFACE_URL_PREFIX
// let prefix_go = UrlPrefixObj.model.INERFACE_URL_PREFIX /**
// //let prefix = '/traceapi/'; * 配置请求url
// /** */
// * 配置请求url export class GO_URLS {
// */ static sendSms = prefix_go + '/api/user/sendSms'; // 短信验证码
// export class GO_URLS { static login = prefix_go + '/api/user/login'; // 登录
// static sendSms = prefix_go + '/api/user/sendSms'; // 短信验证码 static list = prefix_go + '/api/proof/list'; // 获取存证列表
// static login = prefix_go + '/api/user/login'; // 登录 static systemList = prefix_go + '/api/template/systemList'; // 获取系统模板
// static list = prefix_go + '/api/proof/list'; // 获取存证列表 static personList = prefix_go + '/api/template/list'; // 获取个人模板
// static systemList = prefix_go + '/api/template/systemList'; // 获取系统模板 static folderList = prefix_go + '/api/template/folderList'; // 获取个人文件夹列表
// static personList = prefix_go + '/api/template/list'; // 获取个人模板 static getSystemTemplate = prefix_go + '/api/template/get'; // 获取单个模板
// static folderList = prefix_go + '/api/template/folderList'; // 获取个人文件夹列表 static add = prefix_go + '/api/proof/add';//创建存证
// static getSystemTemplate = prefix_go + '/api/template/get'; // 获取单个模板 static sendBlockChian = prefix_go + '/api/proof/sendBlockChain';// 上链
// static add = prefix_go + '/api/proof/add';//创建存证 static proof = prefix_go + '/api/proof/get';// 查询单个存证
// static sendBlockChian = prefix_go + '/api/proof/sendBlockChain';// 上链 static update = prefix_go + '/api/proof/update';// 编辑单个存证
// static proof = prefix_go + '/api/proof/get';// 查询单个存证 static delete = prefix_go + '/api/proof/delete';// 删除存证
// static update = prefix_go + '/api/proof/update';// 编辑单个存证 static abandon = prefix_go + '/api/proof/abandon';// 移入回收站
// static delete = prefix_go + '/api/proof/delete';// 删除存证 static isSetPwd = prefix_go + '/api/user/isSetPwd'; //是否设置过密码
// static abandon = prefix_go + '/api/proof/abandon';// 移入回收站 static setPwd = prefix_go + '/api/user/setPwd'; //设置密码
// static isSetPwd = prefix_go + '/api/user/isSetPwd'; //是否设置过密码 static sendEmail = prefix_go + '/api/user/sendEmail'; // email验证码
// static setPwd = prefix_go + '/api/user/setPwd'; //设置密码 static upload = prefix_go + '/api/file/upload'; // 单个上传文件
// static sendEmail = prefix_go + '/api/user/sendEmail'; // email验证码 static getFiles = prefix_go + '/api/file/getFiles'; // 批量查询文件
// static upload = prefix_go + '/api/file/upload'; // 单个上传文件 static increment = prefix_go + '/api/proof/increment/add'; // 批量查询文件
// static getFiles = prefix_go + '/api/file/getFiles'; // 批量查询文件 static incrementList = prefix_go + '/api/proof/increment/list'; // 查询增量数据列表
// static increment = prefix_go + '/api/proof/increment/add'; // 批量查询文件 static incrementId = prefix_go + '/api/proof/increment' // 获取增量数据
// static incrementList = prefix_go + '/api/proof/increment/list'; // 查询增量数据列表 static sendBlockIncrementChain = prefix_go + '/api/proof/increment/sendBlockChain' // 增量存证上链
// static incrementId = prefix_go + '/api/proof/increment' // 获取增量数据 static deleteIncrement = prefix_go + '/api/proof/increment' // 删除增量存证
// static sendBlockIncrementChain = prefix_go + '/api/proof/increment/sendBlockChain' // 增量存证上链 static user = prefix_go + '/api/user' // 获取个人信息
// static deleteIncrement = prefix_go + '/api/proof/increment' // 删除增量存证 static basic = prefix_go + '/api/auth/company/basic'
// static user = prefix_go + '/api/user' // 获取个人信息 static info = prefix_go + '/api/auth/company/info'
// static basic = prefix_go + '/api/auth/company/basic' static banks = prefix_go + '/api/auth/company/banks'
// static info = prefix_go + '/api/auth/company/info' static bank = prefix_go + '/api/auth/company/bank'
// static banks = prefix_go + '/api/auth/company/banks' static bankNum = prefix_go + '/api/auth/company/bankNum'
// static bank = prefix_go + '/api/auth/company/bank' static bankcard4c = prefix_go + '/api/auth/user/bankcard4c'
// static bankNum = prefix_go + '/api/auth/company/bankNum' static get = prefix_go + '/api/auth/user/get'
// static bankcard4c = prefix_go + '/api/auth/user/bankcard4c' static setPhoneCode = prefix_go + '/api/user/setPhoneCode'
// static get = prefix_go + '/api/auth/user/get' static setPhone = prefix_go + '/api/user/setPhone'
// static setPhoneCode = prefix_go + '/api/user/setPhoneCode' static getBalance = prefix_go + '/api/asset/get'
// static setPhone = prefix_go + '/api/user/setPhone' static packageList = prefix_go + '/api/plan/list'
// static getBalance = prefix_go + '/api/asset/get' static addOrder = prefix_go + '/api/order/add'
// static packageList = prefix_go + '/api/plan/list' static pay = prefix_go + '/api/order/pay'
// static addOrder = prefix_go + '/api/order/add' static addFolder = prefix_go + '/api/template/addFolder'
// static pay = prefix_go + '/api/order/pay' static personalList = prefix_go + '/api/template/list'
// static addFolder = prefix_go + '/api/template/addFolder' static customize = prefix_go + '/api/template/customize'
// static personalList = prefix_go + '/api/template/list' static updateCustomize = prefix_go + '/api/template/updateCustomize'
// static customize = prefix_go + '/api/template/customize' static searchCustomize = prefix_go + '/api/template/searchCustomize'
// static updateCustomize = prefix_go + '/api/template/updateCustomize' static deleteCustomize = prefix_go + '/api/template/deleteCustomize'
// static searchCustomize = prefix_go + '/api/template/searchCustomize' static orderType = prefix_go + '/api/order/get'
// static deleteCustomize = prefix_go + '/api/template/deleteCustomize' }
// }
// export class URLS {
// // 二期端口
// // 类目相关
// static GET_ALL_CATEGORY = prefix + UrlPrefixObj.model.INERFACE_URL_SUBPREFIX + '/api/category/all'; // 获取所有分类
// static ADD_CATEGORY = prefix + UrlPrefixObj.model.INERFACE_URL_SUBPREFIX + '/api/category/add'; //添加分类
// static DELETE_CATEGORY = prefix + UrlPrefixObj.model.INERFACE_URL_SUBPREFIX + '/api/category/delete'; //删除分类
// static CATEGORY_RENAME = prefix + UrlPrefixObj.model.INERFACE_URL_SUBPREFIX + '/api/category/edit'; //重命名
// static MOVE_CATEGORY = prefix + UrlPrefixObj.model.INERFACE_URL_SUBPREFIX + '/api/category/move'; // 移动
// // 存证相关
// static GET_INFOS = prefix + UrlPrefixObj.model.INERFACE_URL_SUBPREFIX + '/api/v2/info/list/valid'; // 获取存证列表
// // 模板相关
// static CREATE_TEMPLATE_AND_INFO = prefix + UrlPrefixObj.model.INERFACE_URL_SUBPREFIX + '/api/info/template'; // 创建商品
// static CREATE_TEMPLATE = prefix + UrlPrefixObj.model.INERFACE_URL_SUBPREFIX + '/api/template/create'; // 创建模板
// static DELETE_TEMPLATE = prefix + UrlPrefixObj.model.INERFACE_URL_SUBPREFIX + '/api/template/delete'; // 删除模板
// static TEMPLATE_COPY = prefix + UrlPrefixObj.model.INERFACE_URL_SUBPREFIX + '/api/template/copy'; // 模板复制
// static UPDATE_TEMPLATE = prefix + UrlPrefixObj.model.INERFACE_URL_SUBPREFIX + '/api/template/update'; // 更新模板
// static SYS_TMPL_SAVE = prefix + UrlPrefixObj.model.INERFACE_URL_SUBPREFIX + '/api/system/template/save';//系统模板保存
// //银行相关
// static BANK_NAME = prefix + UrlPrefixObj.model.INERFACE_URL_SUBPREFIX + '/api/bank/name';//银行名称列表
// static SUB_BRANCH = prefix + UrlPrefixObj.model.INERFACE_URL_SUBPREFIX + '/api/bank/list';//获取支行列表
// //个人信息相关
// static USER_INFO = prefix + UrlPrefixObj.model.INERFACE_URL_SUBPREFIX + '/api/user/info';
// static GET_AUTH = prefix + UrlPrefixObj.model.INERFACE_URL_SUBPREFIX + '/api/authenticate/status'; // 查询认证状态
// // END
// // 通用
// static UPLOAD_FILES = prefix + UrlPrefixObj.model.INERFACE_URL_SUBPREFIX + '/api/files'; // 上传多个文件
// // 四期开发
// static BASIC = prefix + UrlPrefixObj.model.INERFACE_URL_SUBPREFIX + '/api/v2/info/basic';// 存证预创建-添加基本信息
// static GOODS_UPLOAD = prefix + UrlPrefixObj.model.INERFACE_URL_SUBPREFIX + '/api/v2/info/blockChain';// 上链
// static COPY_GOODS = prefix + UrlPrefixObj.model.INERFACE_URL_SUBPREFIX + '/api/v2/info/duplicate'; // 复制商品
// static MOVE_GOODS = prefix + UrlPrefixObj.model.INERFACE_URL_SUBPREFIX + '/api/v2/info/motion';// 移动存证到类目
// static GOODS_RENAME = prefix + UrlPrefixObj.model.INERFACE_URL_SUBPREFIX + '/api/v2/info/name'; //重命名
// static DELETE_GOODS = prefix + UrlPrefixObj.model.INERFACE_URL_SUBPREFIX + '/api/v2/info/cancellation'; //删除存证
// static DOWNLOAD_QR = prefix + UrlPrefixObj.model.INERFACE_URL_SUBPREFIX + '/api/v2/info/qrcode';// 下载二维码
// static GET_INFO = prefix + UrlPrefixObj.model.INERFACE_URL_SUBPREFIX + '/api/v2/info'; // 获取存证详情
// static INCREMENT = prefix + UrlPrefixObj.model.INERFACE_URL_SUBPREFIX + '/api/v2/info/increment/name'; // 增量更新
// static TEMPLATE_LIST = prefix + UrlPrefixObj.model.INERFACE_URL_SUBPREFIX + '/api/template/get/list'; // 模板列表查询
// static SYS_TMPL_LIST = prefix + UrlPrefixObj.model.INERFACE_URL_SUBPREFIX + '/api/system/template/get/list';//系统模板列表查询
// static TEMPLATE_DETAIL = prefix + UrlPrefixObj.model.INERFACE_URL_SUBPREFIX + '/api/template/get'; // 查询个人模板
// static SYS_TMPL_GET = prefix + UrlPrefixObj.model.INERFACE_URL_SUBPREFIX + '/api/system/template/get';//查询系统模板
// static ESSENTIAL_INFORMATION = prefix + UrlPrefixObj.model.INERFACE_URL_SUBPREFIX + '/api/v2/info/basic';//查询存证基本信息
// static EDIT_INFORMATION = prefix + UrlPrefixObj.model.INERFACE_URL_SUBPREFIX + '/api/v2/info/basic';//编辑存证基本信息
// static PUT_INFO = prefix + UrlPrefixObj.model.INERFACE_URL_SUBPREFIX + '/api/v2/info/detail'; // 存证完善创建-编辑详情信息
// static INVALID = prefix + UrlPrefixObj.model.INERFACE_URL_SUBPREFIX + '/api/v2/info/list/inValid'; // 查询产品列表-PC回收站列表查询
// static ICON = prefix + UrlPrefixObj.model.INERFACE_URL_SUBPREFIX + '/api/user/icon'; //上传头像
// static BALANCE = prefix + UrlPrefixObj.model.INERFACE_URL_SUBPREFIX + '/api/user/balance'; //获取用户余额
// static HASHLIST = prefix + UrlPrefixObj.model.INERFACE_URL_SUBPREFIX + '/api/tnv/file/hashList'; //通过文件hash查找文件
// static SYS_TMPL_COPY = prefix + UrlPrefixObj.model.INERFACE_URL_SUBPREFIX + '/api/system/template/copy';//复制系统模板
// // 新增文件上传接口
// static UPLOAD_IMAGE = prefix + UrlPrefixObj.model.INERFACE_URL_SUBPREFIX + '/api/file/image'; // 上传单个图片文件
// static UPLOAD_PDF = prefix + UrlPrefixObj.model.INERFACE_URL_SUBPREFIX + '/api/file/pdf'; // 上传单个pdf文件
// // /api/file/video
// static UPLOAD_VIDEO = prefix + UrlPrefixObj.model.INERFACE_URL_SUBPREFIX + '/api/file/video'; // 上传单个video文件
// }
// // 个人中心相关
// export class USER_CENTER_URLS {
// //获取用户信息
// static USER_INFO = prefix + UrlPrefixObj.model.INERFACE_URL_SUBPREFIX + '/api/user/info';
// // 登录状态短信验证码
// static SMS_LOGIN = prefix + 'sso/api/sms/captcha';
// // 未登录状态短信验证码
// static SMS_UNLOGIN = prefix + 'sso/api/tnv/sms/captcha';
// // 个人认证短信验证码接口
// static SMS_PERSON_VERIFY = prefix + UrlPrefixObj.model.INERFACE_URL_SUBPREFIX + '/api/authenticate/send';
// // 未登录状态修改密码
// static EDIT_PASSWORD_UNLOGIN = prefix + 'sso/api/tnv/update/password';
// // 校验修改密码验证码
// static CHECK_SMS_PASSWORD = prefix + 'sso/api/update/password';
// // 修改密码
// static EDIT_PASSWORD = prefix + 'sso/api/update/password/confirm';
// // 校验修改手机验证码
// static CHECK_SMS_PHONE = prefix + 'sso/api/update/validate';
// // 修改手机
// static EDIT_PHONE = prefix + 'sso/api/update/phone';
// /**
// * 认证相关
// */
// //---- 企业认证接口 ----//
// static PERSON_VERIFY = prefix + UrlPrefixObj.model.INERFACE_URL_SUBPREFIX + '/api/authenticate/person';
// //---- 企业认证接口 ----//
// // 全国省
// static PROVINCE = prefix + 'other/api/tnv/location/province';
// // 获取省下对应市
// static CITY = prefix + 'other/api/tnv/location/city';
// // 获取支行列表
// static BRANCH_BANK = prefix + UrlPrefixObj.model.INERFACE_URL_SUBPREFIX + '/api/bank/list';
// // 企业基本信息录入
// static COMPANY_BASE = prefix + UrlPrefixObj.model.INERFACE_URL_SUBPREFIX + '/api/authenticate/enterprise/base';
// // 企业银行卡信息录入
// static COMPANY_BANK = prefix + UrlPrefixObj.model.INERFACE_URL_SUBPREFIX + '/api/authenticate/enterprise/bank';
// // 企业打款验证
// static COMPANY_VERIFY = prefix + UrlPrefixObj.model.INERFACE_URL_SUBPREFIX + '/api/authenticate/enterprise/verify';
// // 企业认证状态
// static COMPANY_STATUS = prefix + UrlPrefixObj.model.INERFACE_URL_SUBPREFIX + '/api/authenticate/status'
// }
//const isProd = process.env.VUE_APP_CURRENTMODE ==='prod';
const configModules = { const configModules = {
// slc正式环境
// "prod": {
// CHAIN_BROWSER_URL_PREFIX: 'https://www.lian33.com/',
// INERFACE_URL_PREFIX: 'https://go.zhaobi.xyz',
// INERFACE_URL_SUBPREFIX: 'traceability',
// MAINNET_BLOCKCHAIN_BROWSER: 'https://mainnet.bityuan.com/address',
// PLATFORM_ID: 'febcbaae13751f7f8e44c2f107afb08d',
// TencentCaptcha_MESSAGE_APPID: "2012039037",
// TencentCaptcha_PASSLOGIN_APPID: "2029098605",
// BLOCKCHAIN_BROWSERS: 'https://www.lian33.com/',
// /**
// * 网站入口配置
// */
// INDEX: {
// // page 的入口
// entry: './src/entry/main/main.ts',
// // 模板来源
// template: './public/main/index.html',
// // 在 dist/index.html 的输出
// filename: 'index.html'
// }
// },
// // slc测试环境
// "_test": {
// CHAIN_BROWSER_URL_PREFIX: 'http://47.114.159.142:9021/',
// INERFACE_URL_PREFIX: 'http://fd.33.cn:1134',
// INERFACE_URL_SUBPREFIX: 'traceability',
// MAINNET_BLOCKCHAIN_BROWSER: 'https://mainnet.bityuan.com/address',
// PLATFORM_ID: '1e1312e4488a635c4103c27e7c9b847c',
// TencentCaptcha_MESSAGE_APPID: "2012039037",
// TencentCaptcha_PASSLOGIN_APPID: "2029098605",
// BLOCKCHAIN_BROWSERS: 'http://47.114.159.142:9021/',
// /**
// * 网站入口配置
// */
// INDEX: {
// // page 的入口
// entry: './src/entry/main/main.ts',
// // 模板来源
// template: './public/main/index.html',
// // 在 dist/index.html 的输出
// filename: 'index.html'
// }
// },
// "_zkjc": {
// CHAIN_BROWSER_URL_PREFIX: 'http://47.114.159.142:9021/',
// INERFACE_URL_PREFIX: 'http://fd.33.cn:1134',
// INERFACE_URL_SUBPREFIX: 'traceability',
// MAINNET_BLOCKCHAIN_BROWSER: 'https://mainnet.bityuan.com/address',
// PLATFORM_ID: '1e1312e4488a635c4103c27e7c9b847c',
// TencentCaptcha_MESSAGE_APPID: "2012039037",
// TencentCaptcha_PASSLOGIN_APPID: "2029098605",
// BLOCKCHAIN_BROWSERS: 'http://47.114.159.142:9021/',
// /**
// * 网站入口配置
// */
// INDEX: {
// // page 的入口
// entry: './src/entry/zkjc/main.ts',
// // 模板来源
// template: './public/zkjc/index.html',
// // 在 dist/index.html 的输出
// filename: 'index.html'
// }
// },
// // 项目方正式环境
// "hl_prod": {
// CHAIN_BROWSER_URL_PREFIX: 'https://sclllq.hlczsl.com/',
// INERFACE_URL_PREFIX: 'https://api.hlczsl.com',
// INERFACE_URL_SUBPREFIX: 'traceability',
// MAINNET_BLOCKCHAIN_BROWSER: 'http://mainnet.hlchain.net/addressDetail',
// PLATFORM_ID: '69ff495a7d616c3c77c61f8968abf18f',
// TencentCaptcha_MESSAGE_APPID: "2075578219",
// TencentCaptcha_PASSLOGIN_APPID: "2085858149",
// BLOCKCHAIN_BROWSERS: 'https://sclllq.hlczsl.com/',
// /**
// * 网站入口配置
// */
// INDEX: {
// // page 的入口
// entry: './src/entry/hl/main.ts',
// // 模板来源
// template: './public/hl/index.html',
// // 在 dist/index.html 的输出
// filename: 'index.html'
// }
// },
// // hl测试环境
// "hl_test": {
// CHAIN_BROWSER_URL_PREFIX: 'http://47.74.211.31:9021/',
// INERFACE_URL_PREFIX: 'http://fd.33.cn:1134', //公共登录接口
// INERFACE_URL_SUBPREFIX: 'sinotraceability',
// MAINNET_BLOCKCHAIN_BROWSER: 'https://mainnet.bityuan.com/address',
// PLATFORM_ID: '1e1312e4488a635c4103c27e7c9b847c',
// TencentCaptcha_MESSAGE_APPID: "2012039037",
// TencentCaptcha_PASSLOGIN_APPID: "2029098605",
// BLOCKCHAIN_BROWSERS: 'http://47.74.211.31:9021/',
// /**
// * 网站入口配置
// */
// INDEX: {
// // page 的入口
// entry: './src/entry/hl/main.ts',
// // 模板来源
// template: './public/hl/index.html',
// // 在 dist/index.html 的输出
// filename: 'index.html'
// }
// },
// // 中链
// "zl_prod": {
// CHAIN_BROWSER_URL_PREFIX: 'http://121.196.15.154:80/',
// INERFACE_URL_PREFIX: 'https://www.chainwords.net/root',
// INERFACE_URL_SUBPREFIX: 'sinotraceability',
// MAINNET_BLOCKCHAIN_BROWSER: 'https://mainnet.bityuan.com/address',
// PLATFORM_ID: '9c2c684b71bbcf996338ec50a40685df',
// TencentCaptcha_MESSAGE_APPID: "2046967931",
// TencentCaptcha_PASSLOGIN_APPID: "2049534336",
// BLOCKCHAIN_BROWSERS: 'http://121.196.15.154:80/',
// /**
// * 网站入口配置
// */
// INDEX: {
// // page 的入口
// entry: './src/entry/zl/main.ts',
// // 模板来源
// template: './public/zl/index.html',
// // 在 dist/index.html 的输出
// filename: 'index.html'
// }
// },
// // 中链测试环境
// "zl_test": {
// CHAIN_BROWSER_URL_PREFIX: 'http://47.74.211.31:9021/',
// INERFACE_URL_PREFIX: 'http://fd.33.cn:1134', //公共登录接口
// INERFACE_URL_SUBPREFIX: 'sinotraceability',
// MAINNET_BLOCKCHAIN_BROWSER: 'https://mainnet.bityuan.com/address',
// PLATFORM_ID: 'c28cbd398a61e9022fd6a6835a57dc50',
// TencentCaptcha_MESSAGE_APPID: "2012039037",
// TencentCaptcha_PASSLOGIN_APPID: "2029098605",
// BLOCKCHAIN_BROWSERS: 'http://47.74.211.31:9021/',
// /**
// * 网站入口配置
// */
// INDEX: {
// // page 的入口
// entry: './src/entry/zl/main.ts',
// // 模板来源
// template: './public/zl/index.html',
// // 在 dist/index.html 的输出
// filename: 'index.html'
// }
// },
// 重构--test // 重构--test
"refactoring_test": { "refactoring_test": {
CHAIN_BROWSER_URL_PREFIX: 'http://47.114.159.142:9033/', CHAIN_BROWSER_URL_PREFIX: 'http://120.26.174.69:9032/',
INERFACE_URL_PREFIX: '118.89.159.234:46789', INERFACE_URL_PREFIX: 'http://172.16.101.87:46789',
MAINNET_BLOCKCHAIN_BROWSER: 'https://mainnet.bityuan.com/address',
PLATFORM_ID: 'c28cbd398a61e9022fd6a6835a57dc50',
BLOCKCHAIN_BROWSERS: 'http://47.114.159.142:9033/',
/** /**
* 网站入口配置 * 网站入口配置
*/ */
...@@ -171,28 +14,6 @@ const configModules = { ...@@ -171,28 +14,6 @@ const configModules = {
// 在 dist/index.html 的输出 // 在 dist/index.html 的输出
filename: 'index.html' filename: 'index.html'
} }
} },
// 上古环境
// "sg_prod": {
// CHAIN_BROWSER_URL_PREFIX: 'https://llq.sngoa.com/',
// INERFACE_URL_PREFIX: 'https://llq.sngoa.com/root',
// INERFACE_URL_SUBPREFIX: 'traceability', //ok
// MAINNET_BLOCKCHAIN_BROWSER: 'https://mainnet.bityuan.com/address',
// PLATFORM_ID: '65cf74cb1519023664d944759c5a7586', //ok
// TencentCaptcha_MESSAGE_APPID: "2040811804",
// TencentCaptcha_PASSLOGIN_APPID: "2017272423",
// BLOCKCHAIN_BROWSERS: 'https://llq.sngoa.com/',
// /**
// * 网站入口配置
// */
// INDEX: {
// // page 的入口
// entry: './src/entry/sg/main.ts',
// // 模板来源
// template: './public/sg/index.html',
// // 在 dist/index.html 的输出
// filename: 'index.html'
// }
// }
} }
exports.model = configModules[process.env.VUE_APP_CURRENTMODE] exports.model = configModules[process.env.VUE_APP_CURRENTMODE]
\ No newline at end of file
<template>
<div>
<span class="sign-box-type" @click="$emit('phone-email')">手机登录 ></span>
<h1>邮箱登录</h1>
<div class="tip">
您还可以进行
<span @click="changeLogin">{{loginMethod}}</span>&nbsp;登录
</div>
<div>
<el-input
placeholder="请输入邮箱地址"
class="input-box"
v-model.trim="email"
@input="email=email.replace(/[\u4e00-\u9fa5]/ig,'')"
/>
<!-- code输入框 -->
<div class="el-input input-box input-box__code" v-if="loginType===1">
<input
type="text"
maxlength="9"
autocomplete="off"
v-model.trim="code"
@input="code=code.replace(/[^\d]/g,'')"
class="el-input__inner"
placeholder="请输入邮箱验证码"
/>
<div
class="btn"
@click="getCode"
>{{curIntervalSeconds === 0 ? '发送验证码' : curIntervalSeconds + '秒后重新发送'}}</div>
</div>
<!-- 密码输入框 -->
<div class="el-input input-box input-password" v-if="loginType===0">
<input
:type="[openOrClose?'password':'text']"
maxlength="30"
autocomplete="off"
v-model.trim="password"
@input="password=password.replace(/[\u4e00-\u9fa5]/ig,'')"
class="el-input__inner"
placeholder="请输入密码"
/>
<div class="icon" @click="changeOpen">
<i class="iconfont" :class="[openOrClose?'iconYJ':'iconYC']"></i>
</div>
</div>
<!-- 底部登录按钮 -->
<div class="sign-in-btn" @click="loginStart">登录</div>
<!-- 记住密码or设置密码等 -->
<div class="operation-box" v-if="loginType===0">
<div class="left-link-zone">
<el-checkbox v-model="isAutoLogin">记住密码</el-checkbox>
</div>
<div class="right-link-zone">
<a href="javascript:void(0)" class="set-up" @click="SetPassword(2)">设置密码</a>
<a href="javascript:void(0)" @click="SetPassword(3)">忘记密码</a>
</div>
</div>
</div>
</div>
</template>
<script>
import * as storage from "@/entry/refactoring/plugins/storage";
import { GO_URLS } from "@/config/URLS";
let CryptoJS = require("crypto-js");
export default {
data() {
return {
email: "",
code: "",
maxIntervalSeconds: 60,
curIntervalSeconds: 0,
isAutoLogin: false,
loginMethod: "邮箱验证码",
loginType: 0,
openOrClose: true,
password: "",
isclick: true,
};
},
watch: {},
created() {
if (
typeof localStorage.ciphertext === "string" &&
localStorage.ciphertext.length === 0
) {
//本地存在ciphertext,但是没有值,需要清除缓存
localStorage.removeItem("ciphertext");
this.isAutoLogin = false;
} else if (
typeof localStorage.ciphertext === "string" &&
localStorage.ciphertext.length > 0
) {
//"属性和值同时存在"
let ciphertext = localStorage.ciphertext;
let bytes = CryptoJS.AES.decrypt(ciphertext.toString(), "secret key 123");
let json = JSON.parse(bytes.toString(CryptoJS.enc.Utf8));
if (json.login_type === 2) {
this.email = json.email;
this.password = json.pwd;
this.isAutoLogin = true;
}
}
},
methods: {
// 检查是否设置过密码
async checkisSetPwd() {
const res = await this.$ajax({
url: GO_URLS.isSetPwd,
type: "post",
params: {
email: this.email,
},
});
if (res) {
if (res.data && res.data.is_set_pwd === 0) {
this.loginType = 1;
} else {
this.loginType = 0;
}
// 0 未设置密码, 1有密码
}
},
// Email检测
checkEmail() {
if (
!/^([a-zA-Z]|[0-9])(\w|\-)+@[a-zA-Z0-9]+\.([a-zA-Z]{2,4})$/.test(
this.email
)
) {
this.$message.error("邮箱地址有误,请重填");
return false;
} else {
return true;
}
},
// 获取验证码
async getCode() {
if (!this.checkEmail()) return;
if (this.curIntervalSeconds > 0) return;
const res = await this.$ajax({
type: "post",
url: GO_URLS.sendEmail,
params: {
email: this.email,
template_id: 0,
},
});
if (res) {
this.$message({
message: "验证码已发送,请注意查看邮箱",
type: "success",
});
this.curIntervalSeconds = this.maxIntervalSeconds;
this.intervalHandle = setInterval(() => {
if (this.curIntervalSeconds > 0) {
this.curIntervalSeconds--;
} else {
clearInterval(this.intervalHandle);
}
}, 1000);
}
},
// 设置密码
SetPassword(type) {
this.$store.commit("updateBusinessType", type);
this.$emit("SetPassword");
},
// email+验证码登录
async loginStart() {
if (this.isclick) {
this.isclick = false;
if (!this.checkEmail()) {
this.isclick = true;
return;
}
if (this.loginType === 1 && this.code.length < 1) {
this.$message.error("请输入邮箱验证码");
this.isclick = true;
return;
}
if (this.loginType === 0 && this.password === "") {
this.$message.error("请输入密码");
this.isclick = true;
return;
}
var params = {};
if (this.loginType === 1) {
params = {
login_type: 3,
email: this.email,
code: this.code,
};
} else {
params = {
login_type: 2,
email: this.email,
pwd: this.$md5(
String(this.password) + this.$md5(String(this.password.length))
),
};
}
const res = await this.$ajax({
type: "post",
url: GO_URLS.login,
params: params,
});
this.isclick = true;
if (res && res.data) {
sessionStorage.setItem("login_type", 2);
storage.setLogin(res.data, params, this.isAutoLogin);
this.$router.push({ path: "/categoryManage" });
}
}
},
// 是否显示密码
changeOpen() {
this.openOrClose = !this.openOrClose;
},
// 改变登录方式
changeLogin() {
// login_type 0:手机号+密码 1:手机号+验证码 2:邮箱+密码 3:邮箱验+证码
if (this.loginType === 0) {
this.loginType = 1;
this.loginMethod = "邮箱密码";
} else if (this.loginType === 1) {
this.loginType = 0;
this.loginMethod = "邮箱验证码";
}
},
},
};
</script>
<style lang="less" scoped>
.sign-in-btn {
width: 441px;
height: 44px;
background: rgba(63, 121, 254, 1);
border-radius: 4px;
font-size: 14px;
cursor: pointer;
line-height: 44px;
color: white;
text-align: center;
&:hover {
box-shadow: 0px 2px 6px 0px #4a90e2;
}
}
.operation-box {
margin-top: 40px;
.left-link-zone {
float: left;
text-decoration: none;
}
.right-link-zone {
float: right;
a {
font-size: 14px;
color: rgba(121, 125, 132, 1);
text-decoration: none;
}
.set-up {
border-right: 1px solid #797d84;
padding-right: 8px;
margin-right: 8px;
}
}
}
.input-box__code {
position: relative;
.btn {
width: 104px;
position: absolute;
right: 10px;
top: 10px;
text-align: center;
color: #989fa5;
line-height: 25px;
font-size: 12px;
cursor: pointer;
height: 25px;
background: rgba(244, 244, 244, 1);
border-radius: 3px;
}
}
.input-password {
position: relative;
.icon {
cursor: pointer;
position: absolute;
right: 10px;
top: 0;
width: 18px;
line-height: 2.8;
height: 100%;
}
}
.input-box {
margin-bottom: 16px;
/deep/ .el-input__inner {
height: 44px !important;
&::-webkit-input-placeholder {
/* WebKit browsers */
color: #797d84;
}
&:-moz-placeholder {
color: #797d84;
}
&::-moz-placeholder {
/* Mozilla Firefox 19+ */
color: #797d84;
}
&:-ms-input-placeholder {
/* Internet Explorer 10+ */
color: #797d84;
}
}
}
.tip {
height: 20px;
font-size: 14px;
font-weight: 400;
color: rgba(121, 125, 132, 1);
line-height: 20px;
margin-bottom: 24px;
span {
color: #3f79fe;
cursor: pointer;
}
}
.sign-box-type {
position: absolute;
top: 34px;
right: 32px;
font-size: 14px;
color: #5386fb;
cursor: pointer;
}
h1 {
font-size: 30px;
font-weight: 400;
color: rgba(53, 53, 53, 1);
line-height: 42px;
text-align: center;
margin: 0;
margin-top: 96px;
margin-bottom: 36px;
}
</style>
\ No newline at end of file
<template>
<div>
<span class="sign-box-type" @click="$emit('change-email')">邮箱登录 ></span>
<h1>手机登录</h1>
<div class="tip">
您还可以进行
<span @click="changeLogin">{{loginMethod}}</span>&nbsp;登录
</div>
<div>
<el-input
placeholder="请输入手机号"
class="input-box"
v-model.trim="phone"
maxlength="11"
@input="phone=phone.replace(/[^\d]/g,'')"
/>
<!-- code输入框 -->
<div class="el-input input-box input-box__code" v-if="loginType===1">
<input
type="text"
maxlength="9"
autocomplete="off"
v-model.trim="code"
@input="code=code.replace(/[^\d]/g,'')"
class="el-input__inner"
placeholder="请输入短信验证码"
/>
<div
class="btn"
@click="getCode"
>{{curIntervalSeconds === 0 ? '发送验证码' : curIntervalSeconds + '秒后重新发送'}}</div>
</div>
<!-- 密码输入框 -->
<div class="el-input input-box input-password" v-if="loginType===0">
<input
:type="[openOrClose?'password':'text']"
maxlength="30"
autocomplete="off"
v-model.trim="password"
@input="password=password.replace(/[\u4e00-\u9fa5]/ig,'')"
class="el-input__inner"
placeholder="请输入密码"
/>
<div class="icon" @click="changeOpen">
<i class="iconfont" :class="[openOrClose?'iconYJ':'iconYC']"></i>
</div>
</div>
<!-- 底部登录按钮 -->
<div class="sign-in-btn" @click="loginStart">登录</div>
<!-- 记住密码or设置密码等 -->
<div class="operation-box" v-if="loginType===0">
<div class="left-link-zone">
<el-checkbox v-model="isAutoLogin">记住密码</el-checkbox>
</div>
<div class="right-link-zone">
<a href="javascript:void(0)" class="set-up" @click="SetPassword(0)">设置密码</a>
<a href="javascript:void(0)" @click="SetPassword(1)">忘记密码</a>
</div>
</div>
</div>
</div>
</template>
<script>
import * as storage from "@/entry/refactoring/plugins/storage";
import { GO_URLS } from "@/config/URLS";
let CryptoJS = require("crypto-js");
export default {
data() {
return {
phone: "",
code: "",
maxIntervalSeconds: 60,
curIntervalSeconds: 0,
isAutoLogin: false,
loginMethod: "手机验证码",
loginType: 0,
openOrClose: true,
password: "",
isclick: true,
};
},
watch: {
// 电话号码的变化
phone: function (val) {
if (val.length === 11) {
if (!this.checkPhone()) return;
this.checkisSetPwd();
}
},
},
created() {
if (
typeof localStorage.ciphertext === "string" &&
localStorage.ciphertext.length === 0
) {
//本地存在ciphertext,但是没有值,需要清除缓存
localStorage.removeItem("ciphertext");
this.isAutoLogin = false;
} else if (
typeof localStorage.ciphertext === "string" &&
localStorage.ciphertext.length > 0
) {
//"属性和值同时存在"
let ciphertext = localStorage.ciphertext;
let bytes = CryptoJS.AES.decrypt(ciphertext.toString(), "secret key 123");
let json = JSON.parse(bytes.toString(CryptoJS.enc.Utf8));
if (json.login_type === 0) {
this.phone = json.phone;
this.password = json.pwd;
this.isAutoLogin = true;
}
}
},
methods: {
// 检查是否设置过密码
async checkisSetPwd() {
const res = await this.$ajax({
url: GO_URLS.isSetPwd,
type: "post",
params: {
phone: this.phone,
},
});
if (res) {
if (res.data && res.data.is_set_pwd === 0) {
this.loginType = 1;
} else {
this.loginType = 0;
}
// 0 未设置密码, 1有密码
}
},
// 电话检测
checkPhone() {
if (!/^1[3456789]\d{9}$/.test(this.phone)) {
this.$message.error("手机号码有误,请重填");
return false;
} else {
return true;
}
},
// 获取验证码
async getCode() {
if (!this.checkPhone()) return;
if (this.curIntervalSeconds > 0) return;
const res = await this.$ajax({
type: "post",
url: GO_URLS.sendSms,
params: {
phone: this.phone,
template_id: 0,
},
});
if (res) {
this.$message({
message: "短信已发送",
type: "success",
});
this.curIntervalSeconds = this.maxIntervalSeconds;
this.intervalHandle = setInterval(() => {
if (this.curIntervalSeconds > 0) {
this.curIntervalSeconds--;
} else {
clearInterval(this.intervalHandle);
}
}, 1000);
}
},
// 设置密码
SetPassword(type) {
this.$store.commit("updateBusinessType", type);
this.$emit("SetPassword");
},
// 电话+验证码登录
async loginStart() {
if (this.isclick) {
this.isclick = false;
//下面添加需要执行的事件
if (!this.checkPhone()) {
this.isclick = true;
return;
}
if (this.loginType === 1 && this.code.length < 1) {
this.$message.error("请输入短信验证码");
this.isclick = true;
return;
}
if (this.loginType === 0 && this.password === "") {
this.$message.error("请输入密码");
this.isclick = true;
return;
}
var params = {};
if (this.loginType === 1) {
params = {
login_type: 1,
phone: this.phone,
code: this.code,
};
} else {
params = {
login_type: 0,
phone: this.phone,
pwd: this.$md5(
String(this.password) + this.$md5(String(this.password.length))
),
};
}
const res = await this.$ajax({
type: "post",
url: GO_URLS.login,
params: params,
});
this.isclick = true;
if (res && res.data) {
sessionStorage.setItem("login_type", 1);
storage.setLogin(res.data, params, this.isAutoLogin);
this.$router.push({ path: "/categoryManage" });
}
}
},
// 是否显示密码
changeOpen() {
this.openOrClose = !this.openOrClose;
},
// 改变登录方式
changeLogin() {
// login_type 0:手机号+密码 1:手机号+验证码 2:邮箱+密码 3:邮箱验+证码
if (this.loginType === 0) {
this.loginType = 1;
this.loginMethod = "账号密码";
} else if (this.loginType === 1) {
this.loginType = 0;
this.loginMethod = "手机验证码";
}
},
},
};
</script>
<style lang="less" scoped>
.sign-in-btn {
width: 441px;
height: 44px;
background: rgba(63, 121, 254, 1);
border-radius: 4px;
font-size: 14px;
cursor: pointer;
line-height: 44px;
color: white;
text-align: center;
&:hover {
box-shadow: 0px 2px 6px 0px #4a90e2;
}
}
.operation-box {
margin-top: 40px;
.left-link-zone {
float: left;
text-decoration: none;
}
.right-link-zone {
float: right;
a {
font-size: 14px;
color: rgba(121, 125, 132, 1);
text-decoration: none;
}
.set-up {
border-right: 1px solid #797d84;
padding-right: 8px;
margin-right: 8px;
}
}
}
.input-box__code {
position: relative;
.btn {
width: 104px;
position: absolute;
right: 10px;
top: 10px;
text-align: center;
color: #989fa5;
line-height: 25px;
font-size: 12px;
cursor: pointer;
height: 25px;
background: rgba(244, 244, 244, 1);
border-radius: 3px;
}
}
.input-password {
position: relative;
.icon {
cursor: pointer;
position: absolute;
right: 10px;
top: 0;
width: 18px;
line-height: 2.8;
height: 100%;
}
}
.input-box {
margin-bottom: 16px;
/deep/ .el-input__inner {
height: 44px !important;
&::-webkit-input-placeholder {
/* WebKit browsers */
color: #797d84;
}
&:-moz-placeholder {
color: #797d84;
}
&::-moz-placeholder {
/* Mozilla Firefox 19+ */
color: #797d84;
}
&:-ms-input-placeholder {
/* Internet Explorer 10+ */
color: #797d84;
}
}
}
.tip {
height: 20px;
font-size: 14px;
font-weight: 400;
color: rgba(121, 125, 132, 1);
line-height: 20px;
margin-bottom: 24px;
span {
color: #3f79fe;
cursor: pointer;
}
}
.sign-box-type {
position: absolute;
top: 34px;
right: 32px;
font-size: 14px;
color: #5386fb;
cursor: pointer;
}
h1 {
font-size: 30px;
font-weight: 400;
color: rgba(53, 53, 53, 1);
line-height: 42px;
text-align: center;
margin: 0;
margin-top: 96px;
margin-bottom: 36px;
}
</style>
\ No newline at end of file
<template>
<div>
<h1>{{title}}</h1>
<el-input
placeholder="请输入手机号"
class="input-box"
v-model="phone"
v-if="getType===0||getType===1"
maxlength="11"
@input="phone=phone.replace(/[^\d]/g,'')"
/>
<el-input
v-if="getType===2||getType===3"
placeholder="请输入邮箱地址"
class="input-box"
v-model.trim="email"
@blur="cheack"
@input="email=email.replace(/[\u4e00-\u9fa5]/ig,'')"
/>
<!-- code输入框 -->
<div class="el-input input-box input-box__code" v-if="getType===0||getType===1">
<input
type="text"
maxlength="9"
autocomplete="off"
v-model="code"
@input="code=code.replace(/[^\d]/g,'')"
class="el-input__inner"
placeholder="请输入短信验证码"
/>
<div
class="btn"
@click="getCode"
>{{curIntervalSeconds === 0 ? '发送验证码' : curIntervalSeconds + '秒后重新发送'}}</div>
</div>
<div class="el-input input-box input-box__code" v-if="getType===2||getType===3">
<input
type="text"
maxlength="9"
autocomplete="off"
v-model.trim="code"
@input="code=code.replace(/[^\d]/g,'')"
class="el-input__inner"
placeholder="请输入邮箱验证码"
/>
<div
class="btn"
@click="getEmailCode"
>{{curIntervalSeconds === 0 ? '发送验证码' : curIntervalSeconds + '秒后重新发送'}}</div>
</div>
<!-- 密码输入框 -->
<div class="el-input input-box input-password">
<input
:type="[openOrClose1?'password':'text']"
maxlength="30"
autocomplete="off"
v-model.trim="passwordOne"
@input="passwordOne=passwordOne.replace(/[\u4e00-\u9fa5]/ig,'')"
class="el-input__inner"
placeholder="请输入密码"
/>
<div class="icon" @click="changeOpen1">
<i class="iconfont" :class="[openOrClose1?'iconYJ':'iconYC']"></i>
</div>
</div>
<div class="el-input input-box input-password">
<input
:type="[openOrClose2?'password':'text']"
maxlength="30"
autocomplete="off"
v-model.trim="passwordTwo"
@input="passwordTwo=passwordTwo.replace(/[\u4e00-\u9fa5]/ig,'')"
class="el-input__inner"
placeholder="请再次确认密码"
/>
<div class="icon" @click="changeOpen2">
<i class="iconfont" :class="[openOrClose2?'iconYJ':'iconYC']"></i>
</div>
</div>
<div class="sign-in-btn" @click="setPassword">{{title}}</div>
<div class="sign-in-btn--bgw" @click="goback">返回登录</div>
</div>
</template>
<script>
import { GO_URLS } from "@/config/URLS";
export default {
data() {
return {
phone: "",
code: "",
maxIntervalSeconds: 60,
curIntervalSeconds: 0,
openOrClose1: true,
openOrClose2: true,
passwordOne: "",
passwordTwo: "",
Nolanding: false,
title: "",
email: "",
};
},
watch: {
// 电话号码的变化
phone: function (val) {
if (val.length === 11) {
if (!this.checkPhone()) return;
this.checkisSetPwd();
}
},
},
computed: {
getType: function () {
return this.$store.state.businessType;
},
},
created() {
if (this.getType === 0 || this.getType === 2) {
this.title = "设置密码";
} else if (this.getType === 1 || this.getType === 3) {
this.title = "重置密码";
}
},
methods: {
cheack() {
if (!this.email) return;
if (!this.checkEmail()) {
return false;
}
this.checkisSetEPwd();
},
async checkisSetEPwd() {
const res = await this.$ajax({
url: GO_URLS.isSetPwd,
type: "post",
params: {
email: this.email,
},
});
if (res) {
if (res.data && res.data.is_set_pwd === 1 && this.getType === 2) {
this.Nolanding = true;
this.$message("您已经设置过密码,请勿重复设置密码");
} else if (
res.data &&
res.data.is_set_pwd === 0 &&
this.getType === 3
) {
this.Nolanding = true;
this.$message("您还未设置过密码,无需重置密码");
} else {
this.Nolanding = false;
}
// 0 未设置密码, 1有密码
}
},
// 获取emailcode
async getEmailCode() {
if (!this.checkEmail()) return;
// if (!this.checkPhone()) return;
if (this.Nolanding && this.getType === 2) {
this.$message("您已经设置过密码,请勿重复设置密码");
return false;
}
if (this.Nolanding && this.getType === 3) {
this.$message("您还未设置过密码,无需重置密码");
return false;
}
if (this.curIntervalSeconds > 0) return;
const res = await this.$ajax({
type: "post",
url: GO_URLS.sendEmail,
params: {
email: this.email,
template_id: 1,
},
});
if (res) {
this.$message({
message: "验证码已发送,请注意查看邮箱",
type: "success",
});
this.curIntervalSeconds = this.maxIntervalSeconds;
this.intervalHandle = setInterval(() => {
if (this.curIntervalSeconds > 0) {
this.curIntervalSeconds--;
} else {
clearInterval(this.intervalHandle);
}
}, 1000);
}
},
// 检查是否设置过密码
async checkisSetPwd() {
const res = await this.$ajax({
url: GO_URLS.isSetPwd,
type: "post",
params: {
phone: this.phone,
},
});
if (res) {
if (res.data && res.data.is_set_pwd === 1 && this.getType === 0) {
this.Nolanding = true;
this.$message("您已经设置过密码,请勿重复设置密码");
} else if (
res.data &&
res.data.is_set_pwd === 0 &&
this.getType === 1
) {
this.Nolanding = true;
this.$message("您还未设置过密码,无需重置密码");
} else {
this.Nolanding = false;
}
// 0 未设置密码, 1有密码
}
},
// 是否显示密码1
changeOpen1() {
this.openOrClose1 = !this.openOrClose1;
},
// 是否显示密码2
changeOpen2() {
this.openOrClose2 = !this.openOrClose2;
},
// 电话检测
checkPhone() {
if (!/^1[3456789]\d{9}$/.test(this.phone)) {
this.$message.error("手机号码有误,请重填");
return false;
} else {
return true;
}
},
// Email检测
checkEmail() {
if (
!/^([a-zA-Z]|[0-9])(\w|\-)+@[a-zA-Z0-9]+\.([a-zA-Z]{2,4})$/.test(
this.email
)
) {
this.$message.error("邮箱地址有误,请重填");
return false;
} else {
return true;
}
},
// 获取验证码
async getCode() {
if (!this.checkPhone()) return;
if (this.Nolanding && this.getType === 0) {
this.$message("您已经设置过密码,请勿重复设置密码");
return false;
}
if (this.Nolanding && this.getType === 1) {
this.$message("您还未设置过密码,无需重置密码");
return false;
}
if (this.curIntervalSeconds > 0) return;
const res = await this.$ajax({
type: "post",
url: GO_URLS.sendSms,
params: {
phone: this.phone,
template_id: this.getType === 0 ? 1 : 1,
},
});
if (res) {
this.$message({
message: "短信已发送",
type: "success",
});
this.curIntervalSeconds = this.maxIntervalSeconds;
this.intervalHandle = setInterval(() => {
if (this.curIntervalSeconds > 0) {
this.curIntervalSeconds--;
} else {
clearInterval(this.intervalHandle);
}
}, 1000);
}
},
// 检测密码
checkPassword() {
if (
this.passwordOne &&
this.passwordTwo &&
this.passwordOne === this.passwordTwo
) {
return true;
} else {
this.$message.error("两次密码不一致,请检查密码");
return false;
}
},
// 设置密码
async setPassword() {
if (this.Nolanding && (this.getType === 0 || this.getType === 2)) {
this.$message("您已经设置过密码,请勿重复设置密码");
return false;
}
if (this.Nolanding && (this.getType === 1 || this.getType === 3)) {
this.$message("您还未设置过密码,无需重置密码");
return false;
}
if ((this.getType === 1 || this.getType === 0) && !this.checkPhone()) {
return false;
}
if ((this.getType === 2 || this.getType === 3) && !this.checkEmail()) {
return false;
}
if (this.code.length < 1) {
this.$message.error("请输入验证码");
return;
}
if (!this.checkPassword()) return;
var data = {};
if (this.getType === 2 || this.getType === 3) {
data = {
email: this.email,
pwd: this.$md5(
String(this.passwordTwo) +
this.$md5(String(this.passwordTwo.length))
),
code: this.code,
code_type: 1,
};
} else if (this.getType === 1 || this.getType === 0) {
data = {
phone: this.phone,
code_type: 0,
pwd: this.$md5(
String(this.passwordTwo) +
this.$md5(String(this.passwordTwo.length))
),
code: this.code,
};
}
const res = await this.$ajax({
type: "post",
url: GO_URLS.setPwd,
params: data,
});
if (res) {
var message = "";
if (this.getType === 0 || this.getType === 2) {
message = "密码设置成功";
} else if (this.getType === 1 || this.getType === 3) {
message = "密码重置成功";
}
this.$message({
message: message,
type: "success",
});
this.goback();
}
},
// 返回登录
goback() {
this.$emit("showLogin");
},
},
};
</script>
<style lang="less" scoped>
h1 {
font-size: 30px;
font-weight: 400;
color: rgba(53, 53, 53, 1);
line-height: 42px;
text-align: center;
margin: 0;
margin-top: 96px;
margin-bottom: 36px;
}
.input-password {
position: relative;
.icon {
cursor: pointer;
position: absolute;
right: 10px;
top: 0;
width: 18px;
line-height: 2.8;
height: 100%;
}
}
.input-box {
margin-bottom: 16px;
/deep/ .el-input__inner {
height: 44px !important;
&::-webkit-input-placeholder {
/* WebKit browsers */
color: #797d84;
}
&:-moz-placeholder {
color: #797d84;
}
&::-moz-placeholder {
/* Mozilla Firefox 19+ */
color: #797d84;
}
&:-ms-input-placeholder {
/* Internet Explorer 10+ */
color: #797d84;
}
}
}
.input-box__code {
position: relative;
.btn {
width: 104px;
position: absolute;
right: 10px;
top: 10px;
text-align: center;
color: #989fa5;
line-height: 25px;
font-size: 12px;
cursor: pointer;
height: 25px;
background: rgba(244, 244, 244, 1);
border-radius: 3px;
}
}
.sign-in-btn {
width: 441px;
height: 44px;
background: rgba(63, 121, 254, 1);
border-radius: 4px;
font-size: 14px;
cursor: pointer;
line-height: 44px;
color: white;
text-align: center;
&:hover {
box-shadow: 0px 2px 6px 0px #4a90e2;
}
}
.sign-in-btn--bgw {
width: 441px;
height: 44px;
color: rgba(63, 121, 254, 1);
line-height: 44px;
text-align: center;
font-size: 14px;
cursor: pointer;
}
</style>
\ No newline at end of file
// // import '../../class-component-hooks';
// import Vue from 'vue';
// import App from './App.vue';
// import router from './router';
// import axiosPlugin from './plugins/axios-plugin';
// import '../../plugins/element.js';
// import ElementUI from 'element-ui';
// // import store from './store';
// // import vueTencentCaptcha from '@carpenter/vue-tencent-captcha';
// // import Gfilters from '@/utils/tool/filter';
// // Vue.use(vueTencentCaptcha);
// Vue.use(ElementUI);
// Vue.use(axiosPlugin);
// Vue.config.productionTip = false;
// // Gfilters(Vue);
// new Vue({
// router,
// // store,
// render: h => h(App),
// }).$mount('#app');
// import '../../class-component-hooks'; // import '../../class-component-hooks';
import Vue from 'vue'; import Vue from 'vue';
import App from './App.vue'; import App from './App.vue';
import router from './router'; import router from './router';
// import axiosPlugin from './plugins/axios-plugin'; import axiosPlugin from './plugins/axios-plugin';
// import '../../plugins/element.js'; import '../../plugins/element.js';
import ElementUI from 'element-ui'; import ElementUI from 'element-ui';
// import store from './store'; import store from './store';
// import md5 from 'js-md5'
// Vue.prototype.$md5 = md5
// import vueTencentCaptcha from '@carpenter/vue-tencent-captcha'; // import vueTencentCaptcha from '@carpenter/vue-tencent-captcha';
// import Gfilters from '@/utils/tool/filter'; // import Gfilters from '@/utils/tool/filter';
// Vue.use(vueTencentCaptcha); // Vue.use(vueTencentCaptcha);
Vue.use(ElementUI); Vue.use(ElementUI);
// Vue.use(axiosPlugin); Vue.use(axiosPlugin);
Vue.config.productionTip = false; Vue.config.productionTip = false;
// Gfilters(Vue); // Gfilters(Vue);
new Vue({ new Vue({
router, router,
// store, store,
render: h => h(App), render: h => h(App),
}).$mount('#app'); }).$mount('#app');
import axios, { AxiosRequestConfig, AxiosResponse } from 'axios';
import { Message } from 'element-ui';
let router: any = null;
router = require('@/entry/refactoring/router');
import { getLoginCode } from './storage';
export interface ResBase {
code: number;
data: any;
msg: string;
}
// get请求
export interface GetParam {
type: 'get' | 'delete';
url: string;
params?: { [key: string]: any };
header?: Object;
config?: Object;
}
// post请求
export interface PostParam {
type: 'post' | 'put' | 'patch' | 'delete';
url: string;
params?: Object;
header?: Object;
config?: Object;
}
//获取对象的长度
function length(o: object) {
var count = 0;
for (var i in o) {
count++;
}
return count;
};
// ajax
async function ajax(param: PostParam | GetParam) {
try {
const type = param.type.toLowerCase();
const result: AxiosRequestConfig = {
method: type,
url: param.url,
params: {},
headers: {
Authorization: 'Bearer ' + getLoginCode(),
...(param.header || {}),
},
...(param.config || {}),
};
if (param.params) {
if (['get'].includes(type)) {
let restfulUrl = param.url + `?`;
const params = (param as GetParam).params || [];
let num = length(params)
Object.keys(params).forEach(function (key) {
if (num === 1) {
restfulUrl += `${key}=${params[key]}`;
} else {
restfulUrl += `${key}=${params[key]}&`;
num--
}
});
result.url = restfulUrl;
}
else {
result.data = param.params;
}
}
// 返回res
const res: AxiosResponse<ResBase> = await axios(result);
if (res.data.code === 200) { // mock 为 0
return res.data || {};
}
else if (res.data.code == 403) {
Message.warning('登录过期,请刷新页面');
// cleanLogin();
sessionStorage.removeItem("user");
router.push({ path: "/" });
return null;
}
else {
Message(res.data.msg);
return null;
}
} catch (e) {
if (axios.isCancel(e)) {
return null;
}
Message.error('网络异常');
}
}
export {
ajax,
};
export default {
install(Vue: any, funcName: string = '$ajax') {
Object.defineProperty(Vue.prototype, funcName, { value: ajax });
},
};
// import store from '../store/index';
let CryptoJS = require("crypto-js"); let CryptoJS = require("crypto-js");
// const prefix = 'Slc';
// 设置本地数据
// function setLocalItem(key: string, value: any) {
// key = `${prefix}-${key}`;
// value = JSON.stringify(value || '');
// localStorage.setItem(key, value);
// }
// 获取本地数据
// function getLocalItem(key: string) {
// key = `${prefix}-${key}`;
// const data: any = localStorage.getItem(key);
// try {
// return JSON.parse(data);
// } catch (error) {
// }
// return null;
// }
// 清除本地数据
// function removeItem(key: string) {
// if (!key) {
// localStorage.clear();
// }
// key = `${prefix}-${key}`;
// localStorage.removeItem(key);
// }
// 登录&&保存密码至本地 // 登录&&保存密码至本地
export function setLogin(data: Object, params: { export function setLogin(data: Object, params: {
login_type: number, phone: string, pwd: string login_type: number, phone: string, pwd: string
...@@ -53,15 +27,4 @@ export function getLoginCode() { ...@@ -53,15 +27,4 @@ export function getLoginCode() {
return null; return null;
} }
} }
// 获取用户所有信息
export function getLoginName() {
if (sessionStorage.getItem('user')) {
return sessionStorage.getItem('user')
} else {
return null;
}
}
// 退出登录
// export function cleanLogin() {
// removeItem('user');
// }
...@@ -12,12 +12,12 @@ let router = new Router({ // todo 移除旧页面 ...@@ -12,12 +12,12 @@ let router = new Router({ // todo 移除旧页面
name: 'home', name: 'home',
component: () => import('./views/Home.vue'), component: () => import('./views/Home.vue'),
}, },
// 新增部分 // 登录
// { {
// path: '/signIn', path: '/signIn',
// name: 'signIn', name: 'signIn',
// component: () => import('./views/SignIn.vue'), component: () => import('./views/SignIn.vue'),
// }, },
// { // {
// path: '/main', // path: '/main',
// component: () => import(/* webpackChunkName: "main" */ './views/Main.vue'), // component: () => import(/* webpackChunkName: "main" */ './views/Main.vue'),
......
<template>
<div class="sign-in">
<div class="img"></div>
<div class="fixed">
<div class="background-left"></div>
<div class="sign-in-box">
<!-- 手机+密码登录模块 -->
<phone-login
v-if="showPlg"
@change-email="changeEmail"
@SetPassword="showPlg=false;showSpd=true"
></phone-login>
<!-- email登录模块 -->
<email-login
v-if="showEmail"
@phone-email="phoneEmail"
@SetPassword="showEmail=false;showSpd=true"
></email-login>
<!-- 设置密码模块 -->
<set-password v-if="showSpd" @showLogin="showLogin"></set-password>
</div>
</div>
</div>
</template>
<script>
import * as storage from "@/entry/refactoring/plugins/storage";
import { GO_URLS } from "@/config/URLS";
import SetPassword from "@/entry/refactoring/components/signin/setPassword.vue";
import PhoneLogin from "@/entry/refactoring/components/signin/phoneLogin.vue";
import EmailLogin from "@/entry/refactoring/components/signin/emailLogin.vue";
export default {
data() {
return {
showSpd: false, //设置密码
showPlg: true, //手机登录
showEmail: false, // 邮箱登录
};
},
components: {
SetPassword,
PhoneLogin,
EmailLogin,
},
computed: {
getType: function () {
return this.$store.state.businessType;
},
},
methods: {
showLogin() {
this.showSpd = false;
if (this.getType === 0 || this.getType === 1) {
this.showPlg = true;
} else {
this.showEmail = true;
}
},
// 切换至email登录
changeEmail() {
this.showEmail = true;
this.showPlg = false;
},
// 切换至手机登录
phoneEmail() {
this.showEmail = false;
this.showPlg = true;
},
},
};
</script>
<style lang="less" scoped>
.sign-in {
position: relative;
background: #ececec;
}
.img {
position: absolute;
left: 26px;
top: 14px;
width: 100px;
height: 30px;
background: url("../images/logo.png") no-repeat center;
background-size: 100% 100%;
}
.fixed {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 895px;
box-shadow: 0px 2px 30px 0px rgba(0, 0, 0, 0.07);
}
.sign-in-box {
width: 443px;
height: 554px;
background: rgba(255, 255, 255, 1);
border-radius: 4px;
padding: 0 26px;
float: left;
position: relative;
}
.background-left {
background: url("../images/login_bg.png") no-repeat center;
background-size: 100%;
float: left;
background-color: #faf8fd;
height: 554px;
width: 400px;
}
</style>
\ No newline at end of file
import Vue from 'vue';
import {
Button,
Container,
Header,
Aside,
Main,
Menu,
Submenu,
MenuItem,
MenuItemGroup,
Table,
TableColumn,
Input,
Notification,
Form,
FormItem,
Row,
Col,
Select,
Option,
Switch,
InputNumber,
Tree,
Tag,
Steps,
Step,
Cascader,
Upload,
Loading,
} from 'element-ui';
Vue.use(Button);
Vue.use(Container);
Vue.use(Header);
Vue.use(Aside);
Vue.use(Main);
Vue.use(Menu);
Vue.use(Submenu);
Vue.use(MenuItem);
Vue.use(MenuItemGroup);
Vue.use(Table);
Vue.use(TableColumn);
Vue.use(Input);
Vue.use(Form);
Vue.use(FormItem);
Vue.use(Row);
Vue.use(Col);
Vue.use(Select);
Vue.use(Option);
Vue.use(Switch);
Vue.use(InputNumber);
Vue.use(Tree);
Vue.use(Tag);
Vue.use(Steps);
Vue.use(Step);
Vue.use(Cascader);
Vue.use(Upload);
Vue.use(Loading);
Vue.prototype.$notify = Notification;
\ No newline at end of file
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