17 changed files with 6107 additions and 741 deletions
@ -1 +1,2 @@ |
|||||
node_modules |
node_modules |
||||
|
dist |
@ -0,0 +1,30 @@ |
|||||
|
describe('The Home Page', () => { |
||||
|
beforeEach(() => { |
||||
|
cy.visit('http://localhost:8080') |
||||
|
}) |
||||
|
it('标题的文字', () => { |
||||
|
cy.get('.login-title > span').should('have.text', "登录智慧能源") |
||||
|
}) |
||||
|
it('输入不规范账号密码', () => { |
||||
|
cy.intercept( |
||||
|
'https://www.enesoon-saas-back-test.cn:8381/**/*', |
||||
|
{ middleware: true }, |
||||
|
(req) => { |
||||
|
req.on('before:response', (res) => { |
||||
|
// force all API responses to not be cached
|
||||
|
res.headers['cache-control'] = 'no-store' |
||||
|
}) |
||||
|
} |
||||
|
).as('login'); |
||||
|
|
||||
|
cy.get('body > uni-app > uni-page > uni-page-wrapper > uni-page-body > uni-view > uni-view:nth-child(2) > uni-view:nth-child(1) > uni-input > div > input') |
||||
|
.type('have.text') |
||||
|
cy.get('body > uni-app > uni-page > uni-page-wrapper > uni-page-body > uni-view > uni-view:nth-child(2) > uni-view:nth-child(2) > uni-input > div > input') |
||||
|
.type('have.text') |
||||
|
cy.get('.login').click() |
||||
|
cy.wait("@login").its('response.body').should((rep) => { |
||||
|
expect(rep).to.have.property("code", 1) |
||||
|
expect(rep).to.have.property("message", '用户名非邮箱手机号') |
||||
|
}) |
||||
|
}) |
||||
|
}) |
@ -0,0 +1,98 @@ |
|||||
|
|
||||
|
const { src, dest, parallel, series, watch } = require('gulp'); |
||||
|
const del = require('del'); |
||||
|
const inject = require('gulp-inject'); |
||||
|
const rename = require('gulp-rename'); |
||||
|
const pug = require('gulp-pug'); |
||||
|
const less = require('gulp-less'); |
||||
|
const path = require('path'); |
||||
|
const es = require('event-stream'); |
||||
|
const browserSync = require('browser-sync').create(); |
||||
|
const reload = browserSync.reload; |
||||
|
|
||||
|
let srcPath = "src" |
||||
|
// let distPath = "node_modules/.gcache"
|
||||
|
let distPath = "dist" |
||||
|
|
||||
|
/** |
||||
|
* 删除输出文件夹目录 |
||||
|
*/ |
||||
|
function remove() { |
||||
|
return del(['dist/**/*']); |
||||
|
} |
||||
|
function removeStatic() { |
||||
|
return del(['dist/static/**/*']); |
||||
|
} |
||||
|
// 处理公共库
|
||||
|
function common() { |
||||
|
let commonJS = src([`${srcPath}/common/**/*.js`,`!${srcPath}/**/__*`]).pipe(rename({suffix: "._cn",dirname: 'js'})) |
||||
|
let commonCSS = src([`${srcPath}/common/**/*.css`,`!${srcPath}/**/__*`]).pipe(rename({suffix: "._cn",dirname: 'css'})) |
||||
|
let commonLess = src([`${srcPath}/common/**/*.less`,`!${srcPath}/**/__*`]) .pipe(less()).pipe(rename({suffix: "._cn",dirname: 'css', extname: ".css" })) |
||||
|
return es.merge(commonJS, commonCSS, commonLess).pipe(dest(`${distPath}`)) |
||||
|
} |
||||
|
// 处理页面资源
|
||||
|
function page(name="index") { |
||||
|
let pageJS = src([`${srcPath}/js/${name}/**/*`,`!src/**/__*`]).pipe(rename({suffix: `._${name}`,dirname: 'js'})) |
||||
|
let pageLess = src([`${srcPath}/css/${name}/**/*.less`,`!${srcPath}/**/__*`]) .pipe(less()).pipe(rename({suffix: "._cn",dirname: 'css', extname: ".css" })) |
||||
|
let pageCSS = src([`${srcPath}/css/${name}/**/*`,`!${srcPath}/**/__*`]).pipe(rename({suffix: `._${name}`,dirname: 'css'})) |
||||
|
return es.merge(pageJS, pageCSS, pageLess).pipe(dest(`${distPath}`)) |
||||
|
} |
||||
|
// 处理页面资源的包装函数
|
||||
|
function asset(name="index") { |
||||
|
return function asset() { |
||||
|
return page(name) |
||||
|
} |
||||
|
} |
||||
|
// 静态资源
|
||||
|
function static() { |
||||
|
return src(`${srcPath}/static/**/*`).pipe(dest(`${distPath}/static`)) |
||||
|
} |
||||
|
// 处理页面
|
||||
|
function pageFn(name="index") { |
||||
|
return function page() { |
||||
|
const jsCNiles = src(`${distPath}/js/**/*._cn.js`, {read: false}) |
||||
|
const jsFiles = src(`${distPath}/js/**/*._${name}.js`, {read: false}) |
||||
|
const cssCNFiles = src(`${distPath}/css/**/*._cn.css`, {read: false}) |
||||
|
const cssFiles = src(`${distPath}/css/**/*._${name}.css`, {read: false}) |
||||
|
return src([`${srcPath}/html/${name}.pug`,`!${srcPath}/**/__*`]).pipe(pug()).pipe(inject(es.merge( |
||||
|
jsCNiles, |
||||
|
cssCNFiles, |
||||
|
cssFiles, |
||||
|
jsFiles |
||||
|
), {relative: true, ignorePath: `../../${distPath}`})).pipe(dest(`${distPath}`)); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
let task = series(remove,static, common, parallel(asset("index")),parallel(pageFn("index"))) |
||||
|
/** |
||||
|
* 开发时监听 |
||||
|
*/ |
||||
|
function watchTask() { |
||||
|
browserSync.init({ |
||||
|
server: { |
||||
|
baseDir: `./${distPath}` |
||||
|
} |
||||
|
}); |
||||
|
watch([`${srcPath}/static/**/*`], series(removeStatic, static)) |
||||
|
.on("add", reload) |
||||
|
.on("change", reload) |
||||
|
.on("unlink", reload) |
||||
|
watch([`${srcPath}/common/`], common) |
||||
|
.on("add", reload) |
||||
|
.on("change", reload) |
||||
|
.on("unlink", reload) |
||||
|
watch([`${srcPath}/css/**/*`,`${srcPath}/js/**/*`], asset("index")) |
||||
|
.on("add", reload) |
||||
|
.on("change", reload) |
||||
|
.on("unlink", reload) |
||||
|
watch([`${srcPath}/html/**/*`], pageFn("index")) |
||||
|
.on("add", reload) |
||||
|
.on("change", reload) |
||||
|
.on("unlink", reload) |
||||
|
} |
||||
|
|
||||
|
exports.watch = series(task,watchTask) |
||||
|
exports.default = task |
||||
|
|
||||
|
exports.index = series(remove, static, common, asset("index"), pageFn("index")) |
||||
|
exports.about = series(remove, static, common, asset("about"), pageFn("about")) |
File diff suppressed because it is too large
@ -0,0 +1,2 @@ |
|||||
|
@import (reference) "./__meida.less"; |
||||
|
@red: red; |
@ -0,0 +1,28 @@ |
|||||
|
.choose(@type, @style) when (@type=xs){ |
||||
|
@media (max-width: 768px){ |
||||
|
@style(); |
||||
|
} |
||||
|
} |
||||
|
.choose(@type, @style) when (@type=sm){ |
||||
|
@media (max-width: 920px){ |
||||
|
@style(); |
||||
|
} |
||||
|
} |
||||
|
.choose(@type, @style) when (@type=md){ |
||||
|
@media (max-width: 1200px){ |
||||
|
@style(); |
||||
|
} |
||||
|
} |
||||
|
.choose(@type, @style) when (@type=lg){ |
||||
|
@media (max-width: 1366px){ |
||||
|
@style(); |
||||
|
} |
||||
|
} |
||||
|
.loop(@i,@style,@list) when (@i<length(@list)){ |
||||
|
.choose(extract(@list,@i+1),@style); |
||||
|
.loop(@i+1,@style,@list); |
||||
|
} |
||||
|
|
||||
|
.media(@style,@rest...){ |
||||
|
.loop(0,@style,@rest); |
||||
|
} |
@ -0,0 +1,5 @@ |
|||||
|
@import (reference) "./__common.less"; |
||||
|
|
||||
|
.@{red}-w{ |
||||
|
color: @red; |
||||
|
} |
@ -0,0 +1,10 @@ |
|||||
|
@red: green; |
||||
|
.@{red}{ |
||||
|
color: @red; |
||||
|
} |
||||
|
|
||||
|
.container{ |
||||
|
margin: 0 auto; |
||||
|
width: 1200px; |
||||
|
|
||||
|
} |
@ -0,0 +1,2 @@ |
|||||
|
// inject:js |
||||
|
// endinject |
@ -0,0 +1,2 @@ |
|||||
|
// inject:css |
||||
|
// endinject |
@ -0,0 +1,11 @@ |
|||||
|
doctype html |
||||
|
html(lang="zh-cn") |
||||
|
head |
||||
|
block title |
||||
|
title 我的站点 - #{title} |
||||
|
include ../__include/head.pug |
||||
|
block head |
||||
|
body |
||||
|
block content |
||||
|
block foot |
||||
|
include ../__include/foot.pug |
@ -0,0 +1,10 @@ |
|||||
|
//- 继承布局 |
||||
|
extends __layout/layout.pug |
||||
|
|
||||
|
block title |
||||
|
- var title = "哈哈" |
||||
|
|
||||
|
|
||||
|
block content |
||||
|
.container |
||||
|
p 不错了 |
@ -0,0 +1 @@ |
|||||
|
console.log(12311111111); |
@ -0,0 +1 @@ |
|||||
|
sadasdasdas |
Loading…
Reference in new issue