The front end of the cutting edge 10

NPM allows users to download from the server written by someone else third-party packages to local use.
It allows users to download and install the command-line program written by someone else to use local NPM from the server.
It allows users to write their own bag or command line program NPM uploaded to the server for others to use.

 

Command to upgrade npm

Sudo npm npm install -g $
1
if it is Window system using the following command:

-g the install NPM NPM
. 1
2
. 3
global and local installation Installation

npm install express # local installation
npm install express -g # global installation
1
2
The following error occurs if:

ERR Error npm:! Connect ECONNREFUSED 127.0.0.1:8087
1
Solution:

$ npm config set proxy null
1
wx.showToast

icon type, valid values: success, success_no_circle, info, warn, waiting, cancel, download, search, clear.

 

wx.showToast ({title: 'Loading', icon: 'loading', DURATION: 10000});
wx.hideToast ();
. 1
2
wx.showLoading ({title: 'Loading ...'})
wx.hideLoading ( )
. 1
2
wx.showToast (Object Object)
displays a message box

| Title | string | | a | Tips content | |
| icon | String | 'Success' | No | icon | |
| Image | String | | No | path from local custom icons, image takes precedence over icon |
| duration | number | 1500 | No | delay prompted | |
| mask | boolean | false | No | whether to show the transparency mask layer to prevent penetration of touch | |
| success | function | | No | interface call success callback function | |
| fail | function | | No | interface calls the failure callback | |
| Complete | function | | No | interface calls the end of the callback function (call succeeds, the failure will be executed) |
1
2
3
4
5
6
7
8
example Code

wx.showToast ({
title: 'success',
icon: 'Success',
DURATION: 2000
})
. 1
2
. 3
. 4
. 5
What is node.js frame, why select node.js server-side framework for the development, use node.js framework can solve any problem, node.js framework applies to which application development, how to download and use node.js framework, the main features of the Node.js framework, using Node.js framework to understand the basics.

The role of the module, how to use modules, each module objects, properties, methods, and events.

node.js framework for the development web server, the use of express framework for developing web applications, how to use the library to achieve socket.io websocket communication.

If you are using node.js libraries and socket.io production server and a client chat application, how to use and express node.js framework making a web application server and the client.

node.js basics, interactive operating environment -repl node.js in
the Node.js in operating system files, use binary data buffer handling, data communication tcp and udp to create http and https server and client processes and the child, encryption and compression, node.js modules, database access, use express building web applications, use socket.io type implements websocket communication.

Micro letter applet wepyjs third party toast Components
official toast component only supports the display of success, loading two kinds icon.

Installation Components

COM-wepy the install-NPM Toast --save
. 1
introduction means

// index.wpy
<template>
<button @tap="toast" size="mini">第三方组件</button>
</template>
<script>
import wepy from 'wepy';
import Toast from 'wepy-com-toast';

export default class Index extends wepy.page {
components = {
toast: Toast
};
}
</script>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
调用方法

= {Methods
Toast () {
the let Promise = Invoke the this $ ( 'Toast', 'Show', {.
title: 'Custom title',
IMG: 'https://raw.githubusercontent.com/kiinlam/wetoast/master /images/star.png ',
});

promise.then ((D) => {
the console.log ( 'Toast DONE');
});
}
}
. 1
2
. 3
. 4
. 5
. 6
. 7
. 8
. 9
10
. 11
12 is
a micro channel applet for user information

Client calls wx.login, return data with a js_code, for acquiring (unique user identification) and (session key)

After getting js_code, send it to the server, the server carries it to do with the micro-channel interaction server and obtain openid sessionkey

 

Get the phone number
to obtain micro-channel user is bound phone number
because users need to get active trigger to initiate a phone number interface, so the API functions are not invoked, required <button> click to trigger assembly.

Instructions

Need to <button> component open-type settings for getPhoneNumber, when the user clicks and agree that you can get to the encrypted data micro-channel server returned by bindgetphonenumber event callback, and then combined session_key and app_id third party server decrypts get phone number.

The sample code

<Open Button-type = "the getPhoneNumber" bindgetphonenumber = "the getPhoneNumber"> </ Button>
Page ({
the getPhoneNumber (E) {
the console.log (e.detail.errMsg)
the console.log (e.detail.iv)
the console.log (e.detail.encryptedData)
}
})
. 1
2
. 3
. 4
. 5
. 6
. 7
. 8
acquires open json data obtained following structure:

{
"PhoneNumber": "13,580,006,666",
"purePhoneNumber": "13,580,006,666",
"The countryCode": "86",
"Watermark": {
"AppID": "the APPID",
"timestamp": TIMESTAMP
}
}
. 1
2
. 3
. 4
. 5
. 6
. 7
. 8
. 9
parameter type Description
phoneNumber String user's mobile phone number bound (mobile phone number is an overseas will code)
purePhoneNumber phone number without an area code String
countryCode String codes
. 1
2
. 3
. 4
micro-channel applet transmission message template


Step two:

 

//获取access_token
getAccess_token(){
var that = this;
var appId = 'wx******51';
var secret = '36********261';
wx.request({
url: 'https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=' + appId + '&secret=' + secret,
data: {},
header: {
'content-type': 'json'
},
success: function (res) {
console.log("access_token"+res)
that.setData({
access_token: res.data.access_token
})
},
fail:function(res){
console.log("失败"+res)
}
})
},
1
2
3
4
5
6
7
8
9
10
. 11
12 is
13 is
14
15
16
. 17
18 is
. 19
20 is
21 is
22 is
acquired OpenID
// login
wx.login ({
Success: RES => {
// send back to the exchange res.code OpenID, a sessionKey, unionid
IF (res.code) {
var code = res.code; // return code
var for appId = '51 is wxbd2 ******';
var Secret = '3666 ******** 012d621261';
wx.request ({
URL: 'HTTPS :? //api.weixin.qq.com/sns/jscode2session AppID = '+ + for appId' Secret & = '+ + Secret' & js_code = '+ + code' = & grant_type authorization_code ',
Data: {},
header: {
' type-Content ':' JSON '
},
Success:function (res) {
var openid = res.data.openid //返回openid
that.globalData.openid = openid
}
})
}
}
})
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23

 

Guess you like

Origin www.cnblogs.com/hyhy904/p/10965875.html