How to use serve method in Playwright Internal

Best JavaScript code snippet using playwright-internal

pack.js

Source:pack.js Github

copy

Full Screen

1/**2 * Created by horo on 2016/10/21.3 */4$(function () {5 findAll(currentPage);6 findAllServe();7 $("#serveAdd").click(function () {8 $("#servePro").show(200);9 })10 nursifyClass();11})12var serveNamePull = "";13function findAllServe(currentPage) {14 var url = domainUrl + "/serve/services/findAll";15 var getData = {currentPage: currentPage, limit: limit};16 var html = "";17 getAjax(url, false, getData, function (data) {18 var num = data.aaData.length;19 for (var i = 0; i < num; i++) {20 html += '<a value="' + data.aaData[i].id + '" class="servename">' + data.aaData[i].serveName + '</a>';21 }22 html += '<input type="button" value="选择完成" class="btn" id="serversAdd">';23 $("#servePro").html(html);24 $(".servename").click(function () {25 if ($(this).hasClass("colorA")) {26 $(this).removeClass("colorA")27 serveNamePull = serveNamePull.replace('' + $(this).attr("value") + ',', '');28 } else {29 serveNamePull += '' + $(this).attr("value") + ',';30 $(this).addClass("colorA")31 }32 if (serveNamePull == "") {33 $("#serversAdd").css("pointer-events", "none").css("background-color", "#DDDDDD")34 } else {35 $("#serversAdd").css("pointer-events", "auto").css("background-color", "#FF4B01")36 }37 })38 $("#serversAdd").click(function () {39 $("#servePro").hide(200);40 })41 })42}43var pageList;44var pageNp = 1;45function findAll(currentPage) {46 var url = domainUrl + '/serve/service_pack/findAll';47 var getData = {currentPage: currentPage, limit: limit};48 var html = '<table id="aaa"><tbody> <tr> <th>名称</th> <th>折扣</th> <th>开始时间</th> <th>结束时间</th> <th>服务项</th> <th>注意事项</th><th>护理级别</th><th>服务简介</th> <th>操作</th></tr> </tbody>';49 var tile='';50 var num = '';51 var serveNum = '';52 var picture = '';53 getAjax(url, false, getData, function (data) {54 num = data.aaData.length;55 pageList = Math.ceil(data.iTotalRecords / limit);56 for (var i = 0; i < num; i++) {57 var serveList = '';58 for (var j = 0; j < serveNum; j++) {59 serveList += '' + data.aaData[i].servicesList[j].serveName + '、';60 }61 html += '<tr><td>' + data.aaData[i].serveName + '</td><td>' + data.aaData[i].servrRebate + '</td><td>' + data.aaData[i].serveStartDate.substring(0, 11) + '</td>' +62 '<td>' + data.aaData[i].serveEnddate.substring(0, 11) + '</td><td>' + serveList + '</td><td>' + data.aaData[i].serveCare + '</td>' +63 '<td>' + data.aaData[i].serveNurseify.nursifyName + '</td><td>' + data.aaData[i].serveBrief + '</td>' +64 '<td><i class="glyphicon glyphicon-pencil bianji" title="编辑" onclick="make(' + data.aaData[i].id + ')"></i>' +65 '<i class="glyphicon glyphicon-remove shanchu" title="删除" onclick="del(' + data.aaData[i].id + ')"></i></td></tr>';66 if (data.aaData[i].commentPicture.pictureAddress == null) {67 picture = '<img src=' + domainFile + '/assets/images/serve/pack.png onclick="uploadShow(' + data.aaData[i].id + ')"/>';68 } else {69 picture = '<img src="' + domainFile + '/assets/uploadimg/' + data.aaData[i].commentPicture.pictureAddress + '" onclick="uploadShow(' + data.aaData[i].id + ')" />';70 }71 tile += ' <div class="main-modules"><i class="glyphicon glyphicon-pencil bianji" title="编辑" style="margin-right: 30px;" onclick="make(' + data.aaData[i].id + ')"></i><i' +72 ' class="glyphicon glyphicon-remove shanchu" title="删除" onclick="del(' + data.aaData[i].id + ')"></i><ul> <li id="staff-mess1">' + picture + '</li>' +73 ' <li id="staff-mess2"> <ul> <li>名称</li> <li>折扣</li> <li>开始时间</li> <li>结束时间</li> <li>服务项</li> </ul>' +74 ' <ul class="staff-mess-right"> <li>' + data.aaData[i].serveName + '</li> <li>' + data.aaData[i].servrRebate + '</li> <li id="sdate-text" >' + data.aaData[i].serveStartDate.substring(0, 11) + '</li> ' +75 '<li id="edate-text" >' + data.aaData[i].serveEnddate.substring(0, 11) + '</li> <li>' + serveList + '</li> </ul> </li> <li id="staff-mess3"> <ul> <li>注意事项</li>' +76 ' <li>护理级别</li><li>服务简介</li> </ul> ' +77 '<ul class="staff-mess-right"> <li>' + data.aaData[i].serveCare + '</li><li>' + data.aaData[i].serveNurseify.nursifyName + '</li> <li>' + data.aaData[i].serveBrief + '</li>' +78 ' </ul> </li>' +79 ' </ul> </div>';80 }81 html+='</table>';82 if(findAllNum ==1){83 $(".main-module").html(html);84 }else{85 $(".main-module").html(tile);86 }87 if (pageNp == 1) {88 pageNp = 2;89 $(".tcdPageCode").createPage({90 pageCount: pageList,91 current: currentPage,92 backFn: function (p) {93 findAll(p)94 }95 });96 }97 tableTileShow(tile,html);98 })99}100function clearModal() {101 $("#update-btn").hide();102 $("#add-btn").show();103 $("#name").val(""); //服务名称104 $("#care").val(""); //注意事项105 $("#rebate").val(""); //折扣106 $("#brief").val(); //服务简介107}108function add() {109 var serveName = $("#name").val(); //服务名称110 var serveCare = $("#care").val(); //注意事项111 var serveRebate = $("#rebate").val(); //折扣112 var ServeStartDate = $("#sdate").val();//开始时间113 var ServeEnddate = $("#edate").val(); //结束时间114 var serveBrief = $("#brief").val(); //服务简介115 var url = domainUrl + '/serve/service_pack/add';116 var postData = {117 serveDetailed: 1,118 serveName: serveName,119 serveCare: serveCare,120 serveRebate: serveRebate,121 ServeStartdate: ServeStartDate,122 ServeEnddate: ServeEnddate,123 serveServes: serveNamePull,124 serveNurseify: 1,125 serveBrief: serveBrief,126 serveDetailed: ""127 };128 postAjax(url, false, postData, function (data) {129 alert("打包成功");130 findAll(currentPage);131 $('#myModal').modal("hide");132 })133}134function update() {135 var serveName = $("#name").val(); //服务名称136 var serveCare = $("#care").val(); //注意事项137 var serveRebate = $("#rebate").val(); //折扣138 var ServeStartDate = $("#sdate").val();//开始时间139 var ServeEnddate = $("#edate").val(); //结束时间140 var serveNurseify = $("#nurseify").val(); //护理级别141 var serveBrief = $("#brief").val(); //服务简介142 var url = domainUrl + '/serve/service_pack/update';143 var id = $("#xid").text();144 var postData = {145 id: id,146 serveDetailed: 1,147 serveName: serveName,148 serveCare: serveCare,149 serveRebate: serveRebate,150 ServeStartDate: ServeStartDate,151 ServeEnddate: ServeEnddate,152 serveServes: serveNamePull,153 serveNurseify: serveNurseify,154 serveBrief: serveBrief,155 serveDetailed: ""156 };157 postAjax(url, false, postData, function (data) {158 alert("修改成功");159 findAll(currentPage);160 $('#myModal').modal("hide");161 })162}163function del(id) {164 var url = domainUrl + '/serve/service_pack/del';165 var postData = {id: id};166 postAjax(url, false, postData, function (data) {167 alert("刪除成功");168 $("#shanchu-yes").show();169 $("#shanchu-no").hide();170 findAll(currentPage);171 })172}173function make(id) {174 $("#xid").text(id);175 findAllServe();176 $("#update-btn").show();177 $("#add-btn").hide();178 var url = domainUrl + '/serve/service_pack/findAll';179 var getData = {};180 var name, care, rebate, sdate, edate, nurseify, brief;181 getAjax(url, false, getData, function (data) {182 var num = data.aaData.length;183 for (var i = 0; i < num; i++) {184 if (id == data.aaData[i].id) {185 name = data.aaData[i].serveName;186 rebate = data.aaData[i].servrRebate;187 sdate = $("#sdate-text").text();188 edate = $("#edate-text").text();189 care = data.aaData[i].serveCare;190 nurseify = data.aaData[i].serveNurseify.nursifyLeave;191 brief = data.aaData[i].serveBrief;192 $("#name").val(name); //服务名称193 $("#care").val(care); //注意事项194 $("#rebate").val(rebate); //折扣195 $("#sdate").val(sdate);//开始时间196 $("#edate").val(edate); //结束时间197 $("#nurseify").val(nurseify); //护理级别198 $("#brief").val(brief); //服务简介199 }200 }201 $('#myModal').modal("show");202 })203}204function upload(id) {205 $("#box").hide();206 $("#aaaa").hide();207 var url = domainUrl + '/serve/service_pack_picture/adds';208 var postData = {209 servicePackId: id,210 pictureAddress: pathList,211 };212 postAjax(url, false, postData, function (data) {213 alert("上传成功");214 findAll(currentPage);215 })216}217//树218var nursifyClass;219function nursifyClass() {220 var url = domainUrl+"/serve/nurseify/findTreeAll";221 var getData = {currentPage: currentPage, limit: limit};222 var html = '<option value="请选择">请选择</option>'223 getAjax(url, false, getData, function (data) {224 var num = data.aaData[0].length;225 console.log(JSON.stringify(data))226 for (var i = 0; i < num; i++) {227 html += '<option value="' + data.aaData[0][i].id + '">' + data.aaData[0][i].nursifyName + '</option>';228 }229 $("#nurseify").html(html);230 var type = document.getElementById('nurseify');231 type.onchange = function () {232 var id = this.value;233 if (data.aaData[1] != undefined && id != "请选择") {234 for (var i = 0; i < data.aaData[1].length; i++) {235 if (data.aaData[1][i].nursifyTid != null) {236 $("#tr2").show();237 nursifyClass2(id);238 nursifyClass = null;239 } else {240 var selectIndex = document.getElementById("nurseify").selectedIndex;//获得是第几个被选中了241 var selectText = document.getElementById("nurseify").options[selectIndex].value //获得被选中的项目242 nursifyClass = selectText;243 $("#tr2").hide();244 }245 }246 } else {247 var selectIndex = document.getElementById("nurseify").selectedIndex;//获得是第几个被选中了248 var selectText = document.getElementById("nurseify").options[selectIndex].value //获得被选中的项目249 nursifyClass = selectText;250 $("#tr2").hide();251 }252 }253 })254}255function nursifyClass2(id) {256 var url = domainUrl+"/serve/nurseify/findTreeAll";257 var getData = {currentPage: currentPage, limit: limit};258 var html = '<option>请选择</option>'259 getAjax(url, false, getData, function (data) {260 var num = data.aaData[1].length;261 for (var i = 0; i < num; i++) {262 if (id == data.aaData[1][i].nursifyTid) {263 html += '<option value="' + data.aaData[1][i].id + '">' + data.aaData[1][i].nursifyName + '</option>';264 }265 }266 $("#nurseify2").html(html);267 var type = document.getElementById('nurseify2');268 type.onchange = function () {269 var selectIndex = document.getElementById("nurseify2").selectedIndex;//获得是第几个被选中了270 var selectText = document.getElementById("nurseify2").options[selectIndex].value //获得被选中的项目271 nursifyClass = selectText;272 }273 })...

Full Screen

Full Screen

index.js

Source:index.js Github

copy

Full Screen

1/**2 * index.js - 服务开通记录明细3 * @date: 2019-07-104 * @author: WY <yang.wang08@hand-china.com>5 * @version: 0.0.16 * @copyright: Copyright (c) 2018, Hand7 */8import React, { Component } from 'react';9import { connect } from 'dva';10import { Spin, Card, Row, Col, Button } from 'hzero-ui';11import { Bind } from 'lodash-decorators';12import classnames from 'classnames';13import { Header, Content } from 'components/Page';14import { DETAIL_CARD_CLASSNAME } from 'utils/constants';15import { filterNullValueObject, createPagination, getCurrentOrganizationId } from 'utils/utils';16import formatterCollections from 'utils/intl/formatterCollections';17import notification from 'utils/notification';18import intl from 'utils/intl';19import FilterForm from './FilterForm';20import List from './List';21/**22 * 服务开通记录明细23 * @extends {Component} - Detail24 * @reactProps {Object} [match={}] - react-router match路由信息25 * @reactProps {Object} [history={}]26 * @reactProps {Object} serveLog - 数据源27 * @reactProps {Boolean} queryDetailLoading - 申请头数据加载是否完成28 * @reactProps {Boolean} serveListLoading - 服务列表数据加载是否完成29 * @reactProps {Function} [dispatch=function(e) {return e;}] - redux dispatch方法30 * @return React.element31 */32const organizationId = getCurrentOrganizationId();33const promptCode = 'spfm.serveLog';34@connect(({ loading = {} }) => ({35 serveListLoading: loading.effects['serveLog/serveQueryList'],36 queryDetailLoading: loading.effects['serveLog/queryDetailLoading'],37}))38@formatterCollections({ code: ['spfm.serveLog'] })39export default class detail extends Component {40 constructor(props) {41 super(props);42 this.state = {43 selectedRows: [],44 rowDataSource: {},45 detailDataSource: [],46 detailPagination: {},47 };48 }49 componentDidMount() {50 this.serveDetail();51 this.serveQueryList();52 }53 /**54 * 服务开通记录明细-申请头55 * @param {object} params - 采购申请头ID56 */57 @Bind()58 serveDetail() {59 const {60 dispatch,61 match: { params = {} },62 } = this.props;63 dispatch({64 type: 'serveLog/serveDetail',65 payload: {66 ...params,67 },68 }).then(res => {69 if (res) {70 this.setState({71 rowDataSource: res,72 });73 }74 });75 }76 /**77 * serveQueryList - 服务开通记录明细-服务列表78 * @param {number} params - 采购申请行ID79 */80 @Bind()81 serveQueryList(page = {}) {82 const {83 dispatch,84 match: { params = {} },85 } = this.props;86 dispatch({87 type: 'serveLog/serveQueryList',88 payload: {89 ...params,90 page,91 },92 }).then(res => {93 if (res) {94 this.setState({95 detailDataSource: res.content,96 detailPagination: createPagination(res),97 });98 }99 });100 }101 /**102 * 删除选中的行103 */104 @Bind()105 delSeletedRows() {106 const rowKey = 'requestLineId';107 const { dispatch } = this.props;108 const { selectedRows } = this.state;109 const lineIds = selectedRows.map(item => item[rowKey]);110 dispatch({111 type: 'serveLog/serveDelete',112 payload: {113 crmTenant: organizationId,114 lineIds,115 },116 }).then(res => {117 if (res) {118 this.setState({119 selectedRows: [],120 });121 this.serveQueryList();122 }123 });124 }125 /**126 * 设置选中行127 * @param {Array} selectedRows128 */129 @Bind()130 rowSelectChange(_, selectedRows) {131 this.setState({132 selectedRows,133 });134 }135 /**136 * 保存137 */138 @Bind()139 save() {140 const { dispatch } = this.props;141 const { form } = this.formdatas.props;142 const { rowDataSource = {}, detailDataSource = [] } = this.state;143 form.validateFieldsAndScroll((err, values) => {144 if (!err) {145 const data = {146 requestHeader: {147 ...rowDataSource,148 ...values,149 },150 requestLineList: detailDataSource,151 client: 'HZERO',152 };153 dispatch({154 type: 'serveLog/serveSave',155 payload: filterNullValueObject(data),156 }).then(res => {157 if (res) {158 notification.success();159 this.serveDetail();160 this.serveQueryList();161 }162 });163 }164 });165 }166 /**167 * 提交168 */169 @Bind()170 submit() {171 const { history, dispatch } = this.props;172 const { form } = this.formdatas.props;173 const { rowDataSource = {}, detailDataSource = [] } = this.state;174 form.validateFieldsAndScroll((err, values) => {175 if (!err) {176 const data = {177 requestHeader: {178 ...rowDataSource,179 ...values,180 },181 requestLineList: detailDataSource,182 client: 'HZERO',183 };184 dispatch({185 type: 'serveLog/serveSubmit',186 payload: filterNullValueObject(data),187 }).then(res => {188 if (res) {189 notification.success();190 history.push('/spfm/amkt-servelog/list');191 }192 });193 }194 });195 }196 render() {197 const { serveListLoading = false, queryDetailLoading = false } = this.props;198 const {199 selectedRows = [],200 rowDataSource = {},201 detailDataSource = [],202 detailPagination = {},203 } = this.state;204 const selectedRowKeys = selectedRows.map(item => item.requestLineId);205 const fiterProps = {206 rowDataSource,207 formOnRef: node => {208 this.formdatas = node;209 },210 };211 const listProps = {212 selectedRowKeys,213 rowDataSource,214 serveListLoading,215 detailDataSource,216 detailPagination,217 fetchList: this.serveQueryList,218 onRowSelectChange: this.rowSelectChange,219 onDelSeletedRows: this.delSeletedRows,220 onHandlePageChange: this.serveQueryList,221 };222 return (223 <React.Fragment>224 <Header225 backPath="/spfm/amkt-servelog/list"226 title={intl.get(`${promptCode}.view.message.title`).d('服务开通记录')}227 >228 {rowDataSource.status === 'NEW' ? (229 <React.Fragment>230 <Button231 onClick={this.submit}232 disabled={detailDataSource.length === 0}233 type="primary"234 icon="check"235 >236 {intl.get('hzero.common.button.submit').d('提交')}237 </Button>238 <Button onClick={this.save} disabled={detailDataSource.length === 0} icon="save">239 {intl.get('hzero.common.button.save').d('保存')}240 </Button>241 </React.Fragment>242 ) : null}243 </Header>244 <Content>245 <Spin246 spinning={queryDetailLoading || serveListLoading}247 wrapperClassName={classnames('ued-detail-wrapper')}248 >249 <Row gutter={48}>250 <Col span={24}>251 <Card252 key="zuul-rate-limit-header"253 bordered={false}254 className={DETAIL_CARD_CLASSNAME}255 title={intl.get(`${promptCode}.view.message.baseInfo`).d('基本信息')}256 >257 <FilterForm {...fiterProps} />258 </Card>259 </Col>260 </Row>261 <Row gutter={48}>262 <Col span={24}>263 <Card264 key="zuul-rate-limit-header"265 bordered={false}266 className={DETAIL_CARD_CLASSNAME}267 title={intl.get(`${promptCode}.view.message.serveManage`).d('服务清单')}268 >269 <List {...listProps} />270 </Card>271 </Col>272 </Row>273 </Spin>274 </Content>275 </React.Fragment>276 );277 }...

Full Screen

Full Screen

main.js

Source:main.js Github

copy

Full Screen

1'use strict';2$.fn.mytoggle = function () {3 var b = arguments;4 return this.each(function (i, el) {5 var a = function () {6 var c = 0;7 return function () {8 b[c++ % b.length].apply(el, arguments);9 };10 }();11 $(el).click(a);12 });13};14$(function () {15 $('.go_to').click(function () {16 var scroll_el = $(this).attr('href');17 if ($(scroll_el).length != 0) {18 $('html, body').animate({ scrollTop: $(scroll_el).offset().top }, 600);19 }20 return false;21 });22 $('.popup_btn').click(function (e) {23 e.preventDefault();24 $('.popupForm').arcticmodal();25 });26 $('.popup_btn_2').click(function (e) {27 e.preventDefault();28 $('.popupForm2').arcticmodal();29 });30 $('.popup_btn_3').click(function (e) {31 e.preventDefault();32 $('.popupForm3').arcticmodal();33 });34 $('.popup_btn_4').click(function (e) {35 e.preventDefault();36 $('.popupForm4').arcticmodal();37 });38 $('.popup_btn_5').click(function (e) {39 e.preventDefault();40 $('.popupForm5').arcticmodal();41 });42 $('.popup_btn_6').click(function (e) {43 e.preventDefault();44 $('.popupForm6').arcticmodal();45 });46 $('.popup_btn_7').click(function (e) {47 e.preventDefault();48 $('.popupForm7').arcticmodal();49 });50 $('.popup_btn_8').click(function (e) {51 e.preventDefault();52 $('.popupForm8').arcticmodal();53 });54 $('.sendFeedbackForm').click(function (e) {55 e.preventDefault();56 var status = true;57 var name = $(this).parent().find('.name').val();58 var phone = $(this).parent().find('.phone').val();59 var serve = $(this).parent().find('._serve').val();60 var serve_1 = $(this).parent().find('#serve_1').prop("checked");61 var serve_2 = $(this).parent().find('#serve_2').prop("checked");62 var serve_3 = $(this).parent().find('#serve_3').prop("checked");63 var serve_4 = $(this).parent().find('#serve_4').prop("checked");64 var serve_5 = $(this).parent().find('#serve_5').prop("checked");65 var serve_6 = $(this).parent().find('#serve_6').prop("checked");66 var serve_7 = $(this).parent().find('#serve_7').prop("checked");67 var serve_8 = $(this).parent().find('#serve_8').prop("checked");68 var serve_9 = $(this).parent().find('#serve_9').prop("checked");69 var serve_10 = $(this).parent().find('#serve_10').prop("checked");70 var serve_11 = $(this).parent().find('#serve_11').prop("checked");71 var serve_12 = $(this).parent().find('#serve_12').prop("checked");72 var serve_13 = $(this).parent().find('#serve_13').prop("checked");73 var serve_14 = $(this).parent().find('#serve_14').prop("checked");74 var serve_15 = $(this).parent().find('#serve_15').prop("checked");75 var serve_16 = $(this).parent().find('#serve_16').prop("checked");76 var serve_17 = $(this).parent().find('#serve_17').prop("checked");77 var serve_18 = $(this).parent().find('#serve_18').prop("checked");78 var serve_19 = $(this).parent().find('#serve_19').prop("checked");79 var serve_20 = $(this).parent().find('#serve_20').prop("checked");80 var serve_21 = $(this).parent().find('#serve_21').prop("checked");81 var serve_22 = $(this).parent().find('#serve_22').prop("checked");82 var serve_23 = $(this).parent().find('#serve_23').prop("checked");83 var serve_24 = $(this).parent().find('#serve_24').prop("checked");84 if (serve_1) {85 serve_1 = $('#serve_1').parent().find('label').html();86 } else { serve_1 = ""; }87 if (serve_2) {88 serve_2 = $('#serve_2').parent().find('label').html();89 } else { serve_2 = ""; }90 if (serve_3) {91 serve_3 = $('#serve_3').parent().find('label').html();92 } else { serve_3 = ""; }93 if (serve_4) {94 serve_4 = $('#serve_4').parent().find('label').html();95 } else { serve_4 = ""; }96 if (serve_5) {97 serve_5 = $('#serve_5').parent().find('label').html();98 } else { serve_5 = ""; }99 if (serve_6) {100 serve_6 = $('#serve_6').parent().find('label').html();101 } else { serve_6 = ""; }102 if (serve_7) {103 serve_7 = $('#serve_7').parent().find('label').html();104 } else { serve_7 = ""; }105 if (serve_8) {106 serve_8 = $('#serve_8').parent().find('label').html();107 } else { serve_8 = ""; }108 if (serve_9) {109 serve_9 = $('#serve_9').parent().find('label').html();110 } else { serve_9 = ""; }111 if (serve_10) {112 serve_10 = $('#serve_10').parent().find('label').html();113 } else { serve_10 = ""; }114 if (serve_11) {115 serve_11 = $('#serve_11').parent().find('label').html();116 } else { serve_11 = ""; }117 if (serve_12) {118 serve_12 = $('#serve_12').parent().find('label').html();119 } else { serve_12 = ""; }120 if (serve_13) {121 serve_13 = $('#serve_13').parent().find('label').html();122 } else { serve_13 = ""; }123 if (serve_14) {124 serve_14 = $('#serve_14').parent().find('label').html();125 } else { serve_14 = ""; }126 if (serve_15) {127 serve_15 = $('#serve_15').parent().find('label').html();128 } else { serve_15 = ""; }129 if (serve_16) {130 serve_16 = $('#serve_16').parent().find('label').html();131 } else { serve_16 = ""; }132 if (serve_17) {133 serve_17 = $('#serve_17').parent().find('label').html();134 } else { serve_17 = ""; }135 if (serve_18) {136 serve_18 = $('#serve_18').parent().find('label').html();137 } else { serve_18 = ""; }138 if (serve_19) {139 serve_19 = $('#serve_19').parent().find('label').html();140 } else { serve_19 = ""; }141 if (serve_20) {142 serve_20 = $('#serve_20').parent().find('label').html();143 } else { serve_20 = ""; }144 if (serve_21) {145 serve_21 = $('#serve_21').parent().find('label').html();146 } else { serve_21 = ""; }147 if (serve_22) {148 serve_22 = $('#serve_22').parent().find('label').html();149 } else { serve_22 = ""; }150 if (serve_23) {151 serve_23 = $('#serve_23').parent().find('label').html();152 } else { serve_23 = ""; }153 if (serve_24) {154 serve_24 = $('#serve_24').parent().find('label').html();155 } else { serve_24 = ""; }156 if (name == '') {157 $(this).parent().find('.name').css({ border: "1px solid red" });158 status = false;159 } else {160 $(this).parent().find('.name').css({ border: "1px solid #aaa" });161 }162 if (phone == '') {163 $(this).parent().find('.phone').css({ border: "1px solid red" });164 status = false;165 } else {166 $(this).parent().find('.phone').css({ border: "1px solid #aaa" });167 }168 if (status) {169 $.ajax({170 url: "/mail.php",171 type: "POST",172 data: {173 "name": name, "phone": phone, "serve_1": serve_1, "serve_2": serve_2,174 "serve_3": serve_3, "serve_4": serve_4,175 "serve_5": serve_5, "serve_6": serve_6,176 "serve_7": serve_7, "serve_8": serve_8,177 "serve_9": serve_9, "serve_10": serve_10,178 "serve_11": serve_11, "serve_12": serve_12,179 "serve_13": serve_13, "serve_14": serve_14,180 "serve_15": serve_15, "serve_16": serve_16,181 "serve_17": serve_17, "serve_18": serve_18,182 "serve_19": serve_19, "serve_20": serve_20,183 "serve_21": serve_21, "serve_22": serve_22,184 "serve_23": serve_23, "serve_24": serve_24,185 "serve": serve186 },187 success: function() {188 $('.feedbackForm')[0].reset();189 $('.feedbackForm2')[0].reset();190 $.arcticmodal('close');191 $('.successModal').arcticmodal();192 }193 });194 }195 });196 var slider = $('.slider');197 slider.owlCarousel({198 pagination: false,199 items: 1,200 loop: true,201 autoplay: true,202 autoplayTimeout: 10000,203 autoplaySpeed: 1000204 });205 $('.next-slide').click(function () {206 slider.trigger('next.owl.carousel');207 });208 $('.prev-slide').click(function () {209 slider.trigger('prev.owl.carousel');210 });211 $('.photo-grid').find('.item').click(function () {212 var src = $(this).find('.img').attr('data-slide');213 src--;214 $('.slider').trigger('to.owl.carousel', [src, 0]);215 $('.fullImgModal').arcticmodal();216 });217 $('.close').click(function () {218 $.arcticmodal('close');219 });220 $('.questions').find('.title-item').mytoggle(function () {221 $(this).parent().find('.hidden').slideDown();222 }, function () {223 $(this).parent().find('.hidden').slideUp();224 });...

Full Screen

Full Screen

json-serve.js

Source:json-serve.js Github

copy

Full Screen

1if (!String.prototype.format) {2 String.prototype.format = function() {3 var args = arguments;4 return this.replace(/{(\d+)}/g, function(match, number) {5 return typeof args[number] != 'undefined'6 ? args[number]7 : match8 ;9 });10 };11}12// json_serve namespace.13(function( json_serve, $ ) {14 json_serve.total_results = 0;15 json_serve.current_page = 0;16 json_serve.results = null;17 json_serve.form_selector = "form";18 json_serve.submit_selector = "#submit";19 json_serve.filter_selector = "#filter";20 json_serve.query_selector = "#query";21 json_serve.results_selector = "#results";22 json_serve.modal_selector = "#modal";23 json_serve.init = function () {24 json_serve.bind_events();25 json_serve.init_modal();26 json_serve.search();27 };28 json_serve.bind_events = function () {29 $(json_serve.submit_selector).click(json_serve.change_filter);30 $(json_serve.form_selector).submit(json_serve.form_submit);31 };32 json_serve.bind_events_paging = function () {33 $('#first').click(json_serve.first_page);34 $('#previous').click(json_serve.previous_page);35 $('#next').click(json_serve.next_page);36 $('#last').click(json_serve.last_page);37 $('.view').click(json_serve.view_result);38 };39 json_serve.init_modal = function () {40 $(json_serve.modal_selector).modal({41 keyboard: true,42 show: false43 });44 };45 json_serve.total_pages = function () {46 return parseInt(json_serve.total_results / 20);47 };48 json_serve.first_page = function () {49 json_serve.current_page = 0;50 json_serve.search();51 };52 json_serve.previous_page = function () {53 if (json_serve.current_page > 0) {54 json_serve.current_page--;55 }56 json_serve.search();57 };58 json_serve.next_page = function () {59 if (json_serve.current_page < json_serve.total_pages()) {60 json_serve.current_page++;61 }62 json_serve.search();63 };64 json_serve.last_page = function () {65 json_serve.current_page = json_serve.total_pages();66 json_serve.search();67 };68 json_serve.form_submit = function (e) {69 e.preventDefault();70 json_serve.submit();71 };72 json_serve.submit = function () {73 json_serve.current_page = 0;74 json_serve.search();75 };76 json_serve.search = function () {77 $(json_serve.results_selector).html("loading...");78 var skip = json_serve.current_page * 20;79 var filter = $(json_serve.filter_selector).val();80 var query = $(json_serve.query_selector).val();81 var url = "/search?skip={0}&filter={1}&query={2}".format(82 encodeURIComponent(skip),83 encodeURIComponent(filter),84 encodeURIComponent(query));85 var data = $.getJSON(86 url,87 json_serve.process_results).error(88 json_serve.search_error);89 };90 json_serve.search_error = function () {91 alert ("Error fetching data");92 };93 json_serve.process_results = function (data) {94 json_serve.total_results = parseInt(data[0].n);95 // Validate we have results to process.96 if (json_serve.total_results === 0) {97 $(json_serve.results_selector).html("No data found");98 return;99 }100 json_serve.results = data[1];101 var html = json_serve.build_pagination();102 html += json_serve.build_results();103 // Insert html into dom104 $(json_serve.results_selector).html(html);105 // Bind events106 json_serve.bind_events_paging();107 };108 json_serve.build_pagination = function () {109 var data = {110 page: json_serve.current_page + 1,111 total_pages: json_serve.total_pages() + 1,112 total_results: json_serve.total_results113 };114 var template = $('#paging_template').html();115 var html = Mustache.to_html(template, data);116 return html;117 };118 json_serve.build_results = function () {119 var rows = [];120 var row = {columns: []};121 $.each( json_serve.results, function( key, val ) {122 if ( key > 0 && key % 4 === 0 ) {123 rows.push( row );124 row = {columns: []};125 }126 row.columns.push( val );127 });128 if ( row.columns.length > 0 ) {129 rows.push( row );130 }131 // Build the results container html132 var data = {133 rows: rows134 };135 template = $('#results_template').html();136 var html = Mustache.to_html(template, data);137 return html;138 };139 json_serve.view_result = function () {140 var div = $(this).parent().parent().parent();141 $.each(json_serve.results, function (key, val) {142 if (val.id === div.attr('id')) {143 json_serve.build_modal(val);144 }145 });146 };147 json_serve.build_modal = function (val) {148 var title = val.title;149 $(json_serve.modal_selector + ' .modal-title').html(title);150 var rows = "";151 for (key in val) {152 if (val[key] === "") {153 continue;154 }155 var data = {156 key: key,157 raw: val[key],158 value: json_serve.fetch_value159 };160 template = $('#modal_row_template').html();161 rows += Mustache.to_html(template, data);162 }163 var data = {164 rows: rows165 };166 template = $('#modal_template').html();167 html = Mustache.to_html(template, data);168 $(json_serve.modal_selector + ' .modal-body').html(html);169 $(json_serve.modal_selector).modal('show');170 };171 json_serve.fetch_value = function () {172 var fetch = function (value) {173 if (json_serve.is_object(value)) {174 var html = "";175 for (prop in value) {176 if (json_serve.is_object(value[prop])) {177 html += fetch(value[prop]);178 } else {179 html += prop + ": " + json_serve.make_url(value[prop]) + ", ";180 }181 }182 return html.substring(0, html.length - 2) + " ";183 } else {184 return json_serve.make_url(value);185 }186 };187 return fetch(this.raw);188 };189 json_serve.is_object = function (value) {190 if (value !== null && typeof value === 'object') {191 return true;192 } else {193 return false;194 }195 };196 json_serve.make_url = function (str) {197 var pattern = new RegExp('^(https?:\\/\\/)?'+ // protocol198 '((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|'+ // domain name199 '((\\d{1,3}\\.){3}\\d{1,3}))'+ // OR ip (v4) address200 '(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*'+ // port and path201 '(\\?[;&a-z\\d%_.~+=-]*)?'+ // query string202 '(\\#[-a-z\\d_]*)?$','i'); // fragment locator203 if(!pattern.test(str)) {204 return str;205 } else {206 return "<a href='{0}' target='_blank'>{1}</a>".format(str, "Link");207 }208 };...

Full Screen

Full Screen

Serve.test.js

Source:Serve.test.js Github

copy

Full Screen

1import { assert } from 'chai';2import path from 'path';3import fs from 'fs-extra';4import sinon from 'sinon';5import { Serve, headersValue } from '../lib/serve/Serve.js';6/* eslint-disable no-empty-function */7/* eslint-disable require-jsdoc */8describe('Serve', () => {9 const workingDir = path.join('test', 'serve');10 describe('constructor()', () => {11 [12 ['root', 'test-root'],13 ['entrypoint', 'test-entrypoint'],14 ['hostname', 'test-hostname'],15 ['port', 8080],16 ['open', true],17 ['headers', [{ name: 'a', value: 'b' }]],18 ].forEach(([name, value]) => {19 it(`sets ${name} property`, () => {20 const opts = {};21 opts[name] = value;22 const instance = new Serve(opts);23 // @ts-ignore24 assert.equal(instance[name], value);25 });26 });27 });28 describe('setRootPath()', () => {29 after(async () => fs.remove('build'));30 it('sets a default path', async () => {31 const instance = new Serve();32 await instance.setRootPath();33 assert.equal(instance.root, path.resolve('.'));34 });35 it('sets build/ when exists', async () => {36 await fs.ensureDir('build');37 const instance = new Serve();38 await instance.setRootPath();39 assert.equal(instance.root, path.resolve('build'));40 });41 it('sets set path', async () => {42 const root = 'test';43 const instance = new Serve({ root });44 await instance.setRootPath();45 assert.equal(instance.root, path.resolve(root));46 });47 });48 describe('setHeaders()', () => {49 let serve;50 beforeEach(() => {51 serve = new Serve();52 });53 it('sets empty object when no headers are set', () => {54 serve.setHeaders();55 assert.deepEqual(serve[headersValue], {});56 });57 it('sets headers passed in options', () => {58 serve.headers = [{ name: 'a', value: 'b' }, { name: 'c', value: 'd' }];59 serve.setHeaders();60 assert.deepEqual(serve[headersValue], {61 a: 'b',62 c: 'd',63 });64 });65 it('appends non-unique headers', () => {66 serve.headers = [{ name: 'a', value: 'b' }, { name: 'a', value: 'c' }];67 serve.setHeaders();68 assert.deepEqual(serve[headersValue], {69 a: 'b, c',70 });71 });72 });73 describe('stopServer()', () => {74 let serve;75 beforeEach(() => {76 serve = new Serve();77 });78 it('does nothing when no server is created', () => {79 serve.stopServer();80 });81 it('closes the server when created', () => {82 // this just checks whether a function is called to not to create a server83 const server = { close: () => {84 // ...85 } };86 const spy = sinon.spy(server, 'close');87 serve.server = server;88 serve.stopServer();89 assert.isTrue(spy.called);90 });91 it('clears the server variable', () => {92 const server = { close: () => {93 // ...94 } };95 serve.server = server;96 serve.stopServer();97 assert.isUndefined(serve.server);98 });99 });100 describe('_requestHandler()', () => {101 let serve;102 let req;103 let res;104 const f = () => {105 // ...106 };107 beforeEach(async () => {108 serve = new Serve({109 root: path.resolve(workingDir),110 entrypoint: 'index.html',111 });112 req = { url: '' };113 res = { writeHead: f, end: f };114 await serve.setDefaults();115 });116 afterEach(async () => fs.remove(workingDir));117 it('calls _send404() when url is not found', async () => {118 const spy = sinon.spy(serve, '_send404');119 await serve._requestHandler(req, res);120 assert.isTrue(spy.called);121 });122 it('calls _send404() when url is a directory', async () => {123 const loc = path.join(workingDir, 'dir');124 await fs.ensureDir(loc);125 const spy = sinon.spy(serve, '_send404');126 req.url = '/dir';127 await serve._requestHandler(req, res);128 assert.isTrue(spy.called);129 });130 it('returns a content of a file', async () => {131 const file = path.join(workingDir, 'file.js');132 await fs.ensureFile(file);133 await fs.writeFile(file, 'test', 'utf8');134 const spy = sinon.spy(res, 'end');135 req.url = '/file.js';136 await serve._requestHandler(req, res);137 const [content] = spy.args[0];138 assert.equal(content.toString(), 'test');139 });140 it('writes 200 status', async () => {141 const file = path.join(workingDir, 'file.js');142 await fs.ensureFile(file);143 await fs.writeFile(file, 'test', 'utf8');144 const spy = sinon.spy(res, 'writeHead');145 req.url = '/file.js';146 await serve._requestHandler(req, res);147 const [status] = spy.args[0];148 assert.equal(status, 200);149 });150 it('uses "entrypoint" as default index file', async () => {151 const file = path.join(workingDir, 'index.html');152 await fs.ensureFile(file);153 await fs.writeFile(file, 'test', 'utf8');154 const spy = sinon.spy(res, 'end');155 req.url = '/';156 await serve._requestHandler(req, res);157 const [content] = spy.args[0];158 assert.equal(content.toString(), 'test');159 });160 [161 ['index.html', 'text/html'],162 ['file.js', 'application/javascript'],163 ['style.css', 'text/css'],164 ].forEach(([fileName, mime]) => {165 it(`returns ${mime} content type for ${fileName}`, async () => {166 const file = path.join(workingDir, fileName);167 await fs.ensureFile(file);168 await fs.writeFile(file, 'test', 'utf8');169 const spy = sinon.spy(res, 'writeHead');170 req.url = `/${fileName}`;171 await serve._requestHandler(req, res);172 const headers = spy.args[0][1];173 assert.equal(headers['content-type'], mime);174 });175 });176 it('adds headers to the response', async () => {177 serve.headers = [{178 name: 'a',179 value: 'b',180 }];181 await serve.setDefaults();182 const file = path.join(workingDir, 'index.html');183 await fs.ensureFile(file);184 await fs.writeFile(file, 'test', 'utf8');185 const spy = sinon.spy(res, 'writeHead');186 req.url = '/';187 await serve._requestHandler(req, res);188 const headers = spy.args[0][1];189 assert.equal(headers.a, 'b');190 });191 });192 describe('_create()', () => {193 let serve;194 beforeEach(async () => {195 serve = new Serve({196 root: path.resolve(workingDir),197 entrypoint: 'index.html',198 });199 await serve.setDefaults();200 });201 it('creates a server', async () => {202 await serve._create();203 assert.ok(serve.server);204 serve.stopServer();205 });206 });...

Full Screen

Full Screen

serve.task.js

Source:serve.task.js Github

copy

Full Screen

1'use strict';2const gulp = require('gulp');3const serverFactory = require('spa-server');4const config = require('./config');5const serveStatic = require('serve-static');6const path = require('path');7const cssStream = require('./css.stream');8const $ = require('gulp-load-plugins')();9const _ = require('lodash');10const clean = require('gulp-clean');11const bs = require('browser-sync');12const bsSpa = require('browser-sync-spa');13const proxy = require('http-proxy-middleware');14const sequence = require('run-sequence');15let sassScope = _.filter(cssStream, p => /\S+\.scss/i.test(p));16let cssScope = _.filter(cssStream, p => /\S+\.css/i.test(p));17// const APP_SERVE_PORT = process.env.SERVE_PORT || 18081;18const SYNC_PROXY_PORT = process.env.SERVE_PORT || 8081;19gulp.task('serve:sync', () => {20 bs.init({21 startPath: '/',22 debugInfo: true,23 open: true,24 port: SYNC_PROXY_PORT,25 // watchOptions: {26 // ignoreInitial: true,27 // },28 // proxy: {29 // target: `localhost:${APP_SERVE_PORT}`,30 // ws: true,31 // },32 snippetOptions: {33 rule: {34 match: /<\/head>/i,35 fn: (snippet, match) => `${snippet}${match}`36 }37 },38 // server: {39 // baseDir: config.paths.src,40 // // middleware: [41 // // proxy('/', {42 // // target: `http://localhost:${APP_SERVE_PORT}`,43 // // changeOrigin: true,44 // // })45 // // ]46 // },47 ui: false,48 });49});50gulp.task('serve:sync:reload', () => {51 console.log('reload()');52 bs.reload({});53});54gulp.task('serve:watch', () => {55 const options = {56 name: 'serve',57 verbose: true,58 usePolling: true, // true for docker!59 };60 const watchScope = _.map(sassScope, (p) => {61 return `${path.dirname(p)}/*.scss`;62 });63 console.log('Watch scope: ', watchScope);64 gulp.watch(watchScope, options, () => {65 sequence('serve:sass', 'serve:sync:reload');66 });67});68gulp.task('serve:sass', () => {69 console.log('Recompile sass:', sassScope);70 return gulp.src(sassScope)71 .pipe( $.sourcemaps.init() )72 .pipe( $.sass()).on('error', config.errorHandler('Sass') )73 .pipe( $.autoprefixer()).on('error', config.errorHandler('Autoprefixer') )74 .pipe( $.sourcemaps.write() )75 .pipe( $.concat('main.css') )76 .pipe( gulp.dest(path.join(config.paths.tmp, '/serve/assets/css')) )77 // .pipe( bs.stream(path.join(config.paths.tmp, '/serve/assets/css', '/main.css')) )78 .pipe( bs.stream() )79 ;80});81gulp.task('serve:clean', () => {82 return gulp.src(path.join(config.paths.tmp, '/serve/index.html'), {read: false})83 .pipe(clean());84});85gulp.task('serve:main', ['serve:sass', 'serve:watch'], () => {86 bs.use(bsSpa({selector: '[ng-app]'}));87 // const serverConfig = {88 // path: path.join(config.paths.src),89 // port: APP_SERVE_PORT,90 // fallback: {'text/html' : '/index.html'},91 // serveStaticConfig: {},92 // middleware: [93 // serveStatic('.'),94 // serveStatic( path.join(config.paths.tmp, 'serve') ),95 // ]96 // };97 //98 // const server = serverFactory.create(serverConfig);99 // server.start();100 bs.instance = bs({101 files: [path.join(config.paths.src, '/index.html')],102 startPath: '/',103 debugInfo: true,104 open: false,105 port: SYNC_PROXY_PORT,106 watchOptions: {107 ignoreInitial: false,108 },109 // proxy: {110 // target: `localhost:${APP_SERVE_PORT}`,111 // ws: true,112 // },113 snippetOptions: {114 rule: {115 match: /<\/head>/i,116 fn: function (snippet, match) {117 return snippet + match;118 }119 }120 },121 server: {122 baseDir: [config.paths.src, '.', path.join(config.paths.tmp, 'serve')],123 // middleware: [124 // proxy('/', {125 // target: `http://localhost:${APP_SERVE_PORT}`,126 // changeOrigin: true,127 // })128 // ]129 },130 ui: false,131 });132});133gulp.task('serve', ['serve:clean'], () => {134 gulp.start('serve:main');...

Full Screen

Full Screen

connect.js

Source:connect.js Github

copy

Full Screen

1(function() {2 'use strict';3 var utils = require('../lib/grunt-helpers')();4 // The actual grunt server settings5 module.exports = {6 options: {7 port: 9000,8 // Change this to '0.0.0.0' to access the server from outside.9 hostname: 'localhost',10 livereload: 3572911 },12 livereload: {13 options: {14 base: '.tmp',15 open: true,16 index: 'index.html',17 middleware: getMiddleWares('.tmp')18 }19 },20 e2e: {21 options: {22 base: '.e2e',23 port: 9002,24 middleware: getMiddleWares('.e2e')25 }26 },27 e2eDist: {28 options: {29 base: '<%= yeoman.dist %>',30 livereload: false31 }32 },33 test: {34 options: {35 port: 9001,36 middleware: function (connect) {37 var serveStatic = require('serve-static'),38 app = connect();39 return [40 serveStatic('.tmp'),41 serveStatic('test'),42 app.use(43 '/bower_components',44 serveStatic('./bower_components')45 ),46 app.use(47 '/kctAngularFireInterceptor',48 serveStatic('./' + utils.getConfig().app + '/kctAngularFireInterceptor')49 ),50 app.use(51 '/kctCommon',52 serveStatic('./' + utils.getConfig().app + '/kctCommon')53 ),54 app.use(55 '/kctMain',56 serveStatic('./' + utils.getConfig().app + '/kctMain')57 ),58 app.use(59 '/kctProfiles',60 serveStatic('./' + utils.getConfig().app + '/kctProfiles')61 ),62 app.use(63 '/generated/langs',64 serveStatic('./' + utils.getConfig().app + '/generated/langs')65 ),66 app.use(67 '/images',68 serveStatic('./' + utils.getConfig().app + '/images')69 ),70 app.use(71 '/fonts',72 serveStatic('./bower_components/font-awesome/fonts')73 )74 ];75 }76 }77 },78 dist: {79 options: {80 open: true,81 base: '<%= yeoman.dist %>',82 livereload: false83 }84 }85 };86 function getMiddleWares(target) {87 return function (connect) {88 var serveStatic = require('serve-static'),89 app = connect();90 return [91 serveStatic(target),92 app.use(93 '/bower_components',94 serveStatic('./bower_components')95 ),96 app.use(97 '/bower_local',98 serveStatic('./bower_local')99 ),100 app.use(101 '/styles',102 serveStatic(target + '/styles')103 ),104 app.use(105 '/kctAngularFireInterceptor',106 serveStatic('./' + utils.getConfig().app + '/kctAngularFireInterceptor')107 ),108 app.use(109 '/kctCommon',110 serveStatic('./' + utils.getConfig().app + '/kctCommon')111 ),112 app.use(113 '/kctMain',114 serveStatic('./' + utils.getConfig().app + '/kctMain')115 ),116 app.use(117 '/kctProfiles',118 serveStatic('./' + utils.getConfig().app + '/kctProfiles')119 ),120 app.use(121 '/generated/langs',122 serveStatic('./' + utils.getConfig().app + '/generated/langs')123 ),124 app.use(125 '/images',126 serveStatic('./' + utils.getConfig().app + '/images')127 ),128 app.use(129 '/fonts',130 serveStatic('./bower_components/font-awesome/fonts')131 )132 ];133 };134 }135 ...

Full Screen

Full Screen

serveLog.js

Source:serveLog.js Github

copy

Full Screen

1/**2 * model - 服务开通记录3 * @date: 2019-07-104 * @author: WY <yang.wang08@hand-china.com>5 * @version: 0.0.16 * @copyright: Copyright (c) 2018, Hand7 */8import { createPagination, getResponse } from 'utils/utils';9import {10 applyQueryList,11 dredgeQueryList,12 serveQueryList,13 serveDetail,14 serveSave,15 serveSubmit,16 serveDelete,17} from '@/services/amkt/serveLogService';18import { queryMapIdpValue } from 'services/api';19export default {20 namespace: 'serveLog',21 state: {22 applyDataSource: [],23 applyPagination: {},24 DredgeDataSource: [],25 DredgePagination: {},26 statusEnumMap: {}, // 状态值集27 },28 effects: {29 // 服务申请单查询列表30 *applyQueryList({ payload }, { call, put }) {31 const response = getResponse(yield call(applyQueryList, payload));32 if (response) {33 yield put({34 type: 'updateState',35 payload: {36 applyDataSource: response.content,37 applyPagination: createPagination(response),38 },39 });40 }41 },42 // 已开通服务查询列表43 *dredgeQueryList({ payload }, { call, put }) {44 const response = getResponse(yield call(dredgeQueryList, payload));45 if (response) {46 yield put({47 type: 'updateState',48 payload: {49 DredgeDataSource: response.content,50 DredgePagination: createPagination(response),51 },52 });53 }54 },55 // 服务开通记录明细-申请头56 *serveDetail({ payload }, { call }) {57 const response = getResponse(yield call(serveDetail, payload));58 return response;59 },60 // 服务开通记录明细-服务列表61 *serveQueryList({ payload }, { call }) {62 const response = getResponse(yield call(serveQueryList, payload));63 return response;64 },65 // 服务开通记录明细-保存66 *serveSave({ payload }, { call }) {67 const response = getResponse(yield call(serveSave, payload));68 return response;69 },70 // 服务开通记录明细-提交71 *serveSubmit({ payload }, { call }) {72 const response = getResponse(yield call(serveSubmit, payload));73 return response;74 },75 // 服务开通记录明细-删除76 *serveDelete({ payload }, { call }) {77 const response = getResponse(yield call(serveDelete, payload));78 return response;79 },80 // 查询状态值集81 *statusEnumMap(params, { call, put }) {82 const statusEnumMap = getResponse(83 yield call(queryMapIdpValue, {84 flag: 'AMKT.REQUEST_STATUS',85 })86 );87 yield put({88 type: 'updateState',89 payload: {90 statusEnumMap,91 },92 });93 },94 },95 reducers: {96 updateState(state, { payload }) {97 return {98 ...state,99 ...payload,100 };101 },102 },...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1const { serve } = require('@playwright/test');2const { createServer } = require('http');3const server = createServer((req, res) => {4 res.statusCode = 200;5 res.setHeader('Content-Type', 'text/plain');6 res.end('Hello, World!');7});8const port = 8080;9const serverInfo = serve(server, port);10console.log(serverInfo);11const { serve } = require('@playwright/test');12const { createServer } = require('http');13const server = createServer((req, res) => {14 res.statusCode = 200;15 res.setHeader('Content-Type', 'text/plain');16 res.end('Hello, World!');17});18const port = 8080;19const serverInfo = serve(server, port);20console.log(serverInfo);21const { serve } = require('@playwright/test');22const { createServer } = require('http');23const server = createServer((req, res) => {24 res.statusCode = 200;25 res.setHeader('Content-Type', 'text/plain');26 res.end('Hello, World!');27});28const port = 8080;29const serverInfo = serve(server, port);30console.log(serverInfo);31const { serve } = require('@playwright/test');32const { createServer } = require('http');33const server = createServer((req, res) => {34 res.statusCode = 200;35 res.setHeader('Content-Type', 'text/plain');36 res.end('Hello, World!');37});38const port = 8080;39const serverInfo = serve(server, port);40console.log(serverInfo);41const { serve } = require('@playwright/test');42const { createServer } = require('http');43const server = createServer((req, res) => {44 res.statusCode = 200;45 res.setHeader('Content-Type', 'text/plain');46 res.end('Hello, World!');47});48const port = 8080;49const serverInfo = serve(server, port);50console.log(serverInfo);51const { serve } = require('@playwright/test');52const { createServer } = require('http');53const server = createServer((req, res) =>

Full Screen

Using AI Code Generation

copy

Full Screen

1const { serve } = require('playwright-core/lib/server/server');2const { createServer } = require('http');3const { chromium } = require('playwright-core');4const server = createServer((req, res) => {5 res.writeHead(200, { 'Content-Type': 'text/html' });6 res.end('Hello World');7});8serve(server, 8080).then(async () => {9 const browser = await chromium.launch();10 const page = await browser.newPage();11 await page.screenshot({ path: 'example.png' });12 await browser.close();13});14const { serve } = require('playwright-core/lib/server/server');15const { createServer } = require('http');16const { chromium } = require('playwright-core');17const server = createServer((req, res) => {18 res.writeHead(200, { 'Content-Type': 'text/html' });19 res.end('Hello World');20});21serve(server, 8080).then(async () => {22 const browser = await chromium.launch();23 const page = await browser.newPage();24 await page.screenshot({ path: 'example.png' });25 await browser.close();26});27const { serve } = require('playwright-core/lib/server/server');28const { createServer } = require('http');29const { chromium } = require('playwright-core');30const server = createServer((req, res) => {31 res.writeHead(200, { 'Content-Type': 'text/html' });32 res.end('Hello World');33});34serve(server, 8080).then(async () => {35 const browser = await chromium.launch();36 const page = await browser.newPage();37 await page.screenshot({ path: 'example.png' });38 await browser.close();39});

Full Screen

Using AI Code Generation

copy

Full Screen

1const { serve } = require('playwright/lib/server/server');2serve(__dirname, 8080);3const { serve } = require('playwright/lib/server/server');4serve(__dirname, 8080);5const { serve } = require('playwright/lib/server/server');6serve(__dirname, 8080);7const { serve } = require('playwright/lib/server/server');8serve(__dirname, 8080);9const { serve } = require('playwright/lib/server/server');10serve(__dirname, 8080);11const { serve } = require('playwright/lib/server/server');12serve(__dirname, 8080);13const { serve } = require('playwright/lib/server/server');14serve(__dirname, 8080);15const { serve } = require('playwright/lib/server/server');16serve(__dirname, 8080);17const { serve } = require('playwright/lib/server/server');18serve(__dirname, 8080);19const { serve } = require('playwright/lib/server/server');20serve(__dirname, 8080);21const { serve } = require('playwright/lib/server/server');22serve(__dirname, 8080);23const { serve } = require('playwright/lib/server/server');24serve(__dirname, 8080);25const { serve } = require('playwright/lib/server/server');26serve(__dirname, 8080);

Full Screen

Using AI Code Generation

copy

Full Screen

1const { serve } = require('@playwright/test');2const server = await serve({ port: 8080 });3server.route('/hello', (req, res) => {4 res.end('Hello from the server');5});6const { serve } = require('@playwright/test');7const server = await serve({ port: 8080 });8server.route('/hello', (req, res) => {9 res.end('Hello from the server');10});11const { test, expect } = require('@playwright/test');12test('test', async ({ page }) => {13 await page.goto(server.PREFIX + '/hello');14 const text = await page.textContent('body');15 expect(text).toBe('Hello from the server');16});17const { test, expect } = require('@playwright/test');18test('test', async ({ page }) => {19 await page.goto(server.PREFIX + '/hello');20 const text = await page.textContent('body');21 expect(text).toBe('Hello from the server');22});23const { serve } = require('@playwright/test');24const server = await serve({ port: 8080 });25server.route('/hello', (req, res) => {26 res.end('Hello from the server');27});28const { serve } = require('@playwright/test');29const server = await serve({ port: 8080 });30server.route('/hello', (req, res) => {31 res.end('Hello from the server');32});33const { test, expect } = require('@playwright/test');34test('test', async ({ page }) => {35 await page.goto(server.PREFIX + '/hello');36 const text = await page.textContent('body');37 expect(text).toBe('Hello from the server');38});39const { test,

Full Screen

Using AI Code Generation

copy

Full Screen

1const { serve } = require('playwright/lib/server/server');2const server = await serve({3 content: path.resolve(__dirname, 'public')4});5const { serve } = require('playwright/lib/server/server');6const server = await serve({7 content: path.resolve(__dirname, 'public')8});9const { serve } = require('playwright/lib/server/server');10const server = await serve({11 content: path.resolve(__dirname, 'public')12});13const { serve } = require('playwright/lib/server/server');14const server = await serve({15 content: path.resolve(__dirname, 'public')16});17const { serve } = require('playwright/lib/server/server');18const server = await serve({19 content: path.resolve(__dirname, 'public')20});21const { serve } = require('playwright/lib/server/server');22const server = await serve({23 content: path.resolve(__dirname, 'public')24});25const { serve } = require('playwright/lib/server/server');26const server = await serve({27 content: path.resolve(__dirname, 'public')28});29const { serve } = require('playwright/lib/server/server');30const server = await serve({31 content: path.resolve(__dirname, '

Full Screen

Using AI Code Generation

copy

Full Screen

1const { serve } = require("@playwright/test");2const server = serve({3 directory: path.join(__dirname, 'public'),4});5server.close();6const { serve } = require("@playwright/test");7const server = serve({8 directory: path.join(__dirname, 'public'),9});10server.close();11const { serve } = require("@playwright/test");12const server = serve({13 directory: path.join(__dirname, 'public'),14});15server.close();16const { serve } = require("@playwright/test");17const server = serve({18 directory: path.join(__dirname, 'public'),19});20server.close();21const { serve } = require("@playwright/test");22const server = serve({23 directory: path.join(__dirname, 'public'),24});25server.close();26const { serve } = require("@playwright/test");27const server = serve({28 directory: path.join(__dirname, 'public'),29});

Full Screen

Playwright tutorial

LambdaTest’s Playwright tutorial will give you a broader idea about the Playwright automation framework, its unique features, and use cases with examples to exceed your understanding of Playwright testing. This tutorial will give A to Z guidance, from installing the Playwright framework to some best practices and advanced concepts.

Chapters:

  1. What is Playwright : Playwright is comparatively new but has gained good popularity. Get to know some history of the Playwright with some interesting facts connected with it.
  2. How To Install Playwright : Learn in detail about what basic configuration and dependencies are required for installing Playwright and run a test. Get a step-by-step direction for installing the Playwright automation framework.
  3. Playwright Futuristic Features: Launched in 2020, Playwright gained huge popularity quickly because of some obliging features such as Playwright Test Generator and Inspector, Playwright Reporter, Playwright auto-waiting mechanism and etc. Read up on those features to master Playwright testing.
  4. What is Component Testing: Component testing in Playwright is a unique feature that allows a tester to test a single component of a web application without integrating them with other elements. Learn how to perform Component testing on the Playwright automation framework.
  5. Inputs And Buttons In Playwright: Every website has Input boxes and buttons; learn about testing inputs and buttons with different scenarios and examples.
  6. Functions and Selectors in Playwright: Learn how to launch the Chromium browser with Playwright. Also, gain a better understanding of some important functions like “BrowserContext,” which allows you to run multiple browser sessions, and “newPage” which interacts with a page.
  7. Handling Alerts and Dropdowns in Playwright : Playwright interact with different types of alerts and pop-ups, such as simple, confirmation, and prompt, and different types of dropdowns, such as single selector and multi-selector get your hands-on with handling alerts and dropdown in Playright testing.
  8. Playwright vs Puppeteer: Get to know about the difference between two testing frameworks and how they are different than one another, which browsers they support, and what features they provide.
  9. Run Playwright Tests on LambdaTest: Playwright testing with LambdaTest leverages test performance to the utmost. You can run multiple Playwright tests in Parallel with the LammbdaTest test cloud. Get a step-by-step guide to run your Playwright test on the LambdaTest platform.
  10. Playwright Python Tutorial: Playwright automation framework support all major languages such as Python, JavaScript, TypeScript, .NET and etc. However, there are various advantages to Python end-to-end testing with Playwright because of its versatile utility. Get the hang of Playwright python testing with this chapter.
  11. Playwright End To End Testing Tutorial: Get your hands on with Playwright end-to-end testing and learn to use some exciting features such as TraceViewer, Debugging, Networking, Component testing, Visual testing, and many more.
  12. Playwright Video Tutorial: Watch the video tutorials on Playwright testing from experts and get a consecutive in-depth explanation of Playwright automation testing.

Run Playwright Internal automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful