1.2.13 • Published 3 years ago

node-egg-x v1.2.13

Weekly downloads
-
License
ISC
Repository
-
Last release
3 years ago

keywrds

$ paiIpi

To get type suggestions for instance variables (this is not needed for composition API), create a new file called shims-vue-recaptcha-v3.d.ts and put the following inside it:

TypeScript + react 3 To use this package you only need a valid site key for your domain, which you can easily get here. A element wraps an existing element and extends it with new event handlers and styles. It does not create a wrapper element in the DOM.

Draggable items are moved using CSS Transforms. This allows items to be dragged regardless of their current positioning (relative, absolute, or static). Elements can also be moved between drags without incident.

If the item you are dragging already has a CSS Transform applied, it will be overwritten by . Use an intermediate wrapper (...) in this case.

Draggable Usage View the Demo and its source for more.

// extend/helper.js
const crypto = require('crypto');
const path = require('path');
const md5 = require('md5');
module.exports = {
    cryptoPwd(pwd) {
        return crypto.createHash('sha256')
            .update(pwd)
            .digest('hex');
    },
    createName(name) {//文件名 
    <!-- mvc.png -->
        let extname = path.extname(name); //png
        let basename = path.basename(name, extname); //mvc
        let url = JSON.stringify({
            basename,
            time: new Date().getTime()
        })
        return md5(url) + extname;
    }
}

$ Controlled vs. Uncontolled

is a 'batteries-included' component that manages its own state. If you want to completely control the lifecycle of the component, use .

For some users, they may want the nice state management that provides, but occasionally want to programmatically reposition their components. allows this customization via a system that is similar to how React handles form components.

If the prop position: {x: number, y: number} is defined, the will ignore its internal state and use the provided position instead. Alternatively, you can seed the position using defaultPosition. Technically, since works only on position deltas, you could also seed the initial position using CSS top/left.

We make one modification to the React philosophy here - we still allow dragging while a component is controlled. We then expect you to use at least an onDrag or onStop handler to synchronize state.

To disable dragging while controlled, send the prop disabled={true} - at this point the will operate like a completely static component.

var svgCaptcha = require('svg-captcha');
var jwt = require('jsonwebtoken');
const axios = require('axios');
const fs = require('mz/fs');
const path = require('path');
// 注册参数验证
const createLogin = {
    user: "string",
    pwd: "string"
}
const createcaptcha = {
    captcha: "string"
}
class LoginController extends Controller {
    async index() {
        const { ctx } = this;
        ctx.body = 'hi, egg';
    }
    async registry() {
        const { ctx } = this;
        ctx.validate(createLogin, ctx.request.body);
        const data = await ctx.service.home.registrys({ ...ctx.request.body, pwd: ctx.helper.cryptoPwd(ctx.request.body.pwd) });
        console.log(data);
        if (data) {
            ctx.body = {
                code: 200,
                msg: "注册成功",
                status: 'success',
                data
            }
        } else {
            ctx.body = {
                code: 400,
                msg: "注册失败",
                status: "FAILED",
            }
        }
    }

$\color{#FF7D00}{internal state and use the provided position instead. Alternatively, you can seed the position using}$ If the prop position: {x: number, y: number} is defined, the will ignore its internal state and use the provided position instead. Alternatively, you can seed the position using defaultPosition. Technically, since works only on position deltas, you could also seed the initial position using CSS top/left.

We make one modification to the React philosophy here - we still allow dragging while a component is controlled. We then expect you to use at least an onDrag or onStop handler to synchronize state.

 async login() {
        const { ctx } = this;
        const { user, pwd, captcha } = ctx.request.body;
        ctx.validate({ ...createLogin, ...createcaptcha }, ctx.request.body);
        if (captcha.toUpperCase() != ctx.session.captcha.toUpperCase()) {
            ctx.body = {
                code: 400,
                msg: '验证码输入错误,请重新输入!'
            }
            return;
        }
        const data = await ctx.service.home.logins(user, ctx.helper.cryptoPwd(pwd));
        console.log(data);
        if (data) {
            ctx.body = {
                code: 200,
                msg: "登录成功",
                status: 'success',
                token: jwt.sign({
                    data
                }, 'shhhhh', { expiresIn: '1day' }),
                data
            }
        } else {
            ctx.body = {
                code: 400,
                msg: "登录失败",
                status: "FAILED",
            }
        }
    }

pushd(options,) Available options:

-n: Suppresses the normal change of directory when adding directories to the stack, so that only the stack is manipulated. -q: Supresses output to the console. Arguments:

dir: Sets the current working directory to the top of the stack, then executes the equivalent of cd dir. +N: Brings the Nth directory (counting from the left of the list printed by dirs, starting with zero) to the top of the list by rotating the stack. -N: Brings the Nth directory (counting from the right of the list printed by dirs, starting with zero) to the top of the list by rotating the stack. Examples:

async captcha() {
        const { ctx } = this;
        const captcha = svgCaptcha.create({
            size: 4,
            noise: 3,
            color: true,
            height: 40,
            width: 100,
            fontSize: 50
        });
        ctx.session.captcha = captcha.text;
        ctx.response.type = 'svg';
        ctx.body = captcha.data;
    }
    async page() {
        const { ctx } = this;
        const { pageNum = 1, pageSize = 3 } = ctx.query;
        try {
            const res = await ctx.service.home.pageList(pageNum, pageSize);
            console.log(res);
            ctx.body = {
                code: 200,
                msg: "查询成功",
                ...res
            }
        } catch (error) {
            console.log(error);
        }
    }