Commit b3011660 authored by 谢卓城's avatar 谢卓城

更新

parent 8bfe76ae
...@@ -15,3 +15,5 @@ dist ...@@ -15,3 +15,5 @@ dist
# Node.js # Node.js
node_modules/ node_modules/
package/node_modules
dist/miniprogram_npm
if [ ! -n "$2" ];then
echo "########## 安装为npm包为不能为空 ##########"
exit 127
fi
echo "########## npm安装包为 $2 ##########"
echo "########## npm安装包为 $1 ##########"
cd package
ls
if [ "$1" == "1" ];then
echo "########## 安装prod包 ##########"
# npm install $2 --save
else
echo "########## 安装dev包 ##########"
# npm install $2 --save-dev
fi
This diff is collapsed.
{ {
"name": "miniprogram-template", "name": "miniprogram-template",
"version": "1.0.0", "version": "1.0.0",
"description": "gulp miniprogram", "description": "",
"main": "index.js", "main": "index.js",
"author": "shelia", "scripts": {
"license": "MIT", "test": "echo \"Error: no test specified\" && exit 1",
"dev": "gulp dev",
"build": "gulp prod",
"buildminiprogramci": "node miniprogramci.js",
"devPackage": "sh ./npm.sh 0 & npm run buildminiprogramci",
"package": "sh ./npm.sh 1 & npm run buildminiprogramci"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"miniprogram-ci": "^1.0.94"
},
"devDependencies": { "devDependencies": {
"autoprefixer": "^9.7.3", "autoprefixer": "^9.7.3",
"babel-eslint": "^8.2.1", "babel-eslint": "^10.1.0",
"del": "^5.1.0", "del": "^6.0.0",
"eslint": "^4.18.2",
"eslint-config-prettier": "^2.9.0",
"eslint-plugin-import": "^2.8.0",
"eslint-plugin-prettier": "^2.3.1",
"fs": "0.0.1-security",
"gulp": "^4.0.2", "gulp": "^4.0.2",
"gulp-imagemin": "^6.2.0", "gulp-imagemin": "^7.1.0",
"gulp-notify": "^3.2.0", "gulp-notify": "^3.2.0",
"gulp-plumber": "^1.2.1", "gulp-plumber": "^1.2.1",
"gulp-postcss": "^8.0.0", "gulp-postcss": "^9.0.0",
"gulp-rename": "^1.4.0", "gulp-rename": "^2.0.0",
"gulp-replace": "^1.0.0", "gulp-replace": "^1.0.0",
"gulp-sass": "^4.0.2", "gulp-sass": "^4.1.0",
"gulp-tap": "^2.0.0", "gulp-tap": "^2.0.0",
"miniprogram-automator": "^0.10.0",
"path": "^0.12.7", "path": "^0.12.7",
"prettier": "^1.8.2", "yargs": "^16.2.0"
"yargs": "^15.3.1" }
},
"repository": "http://git.changein.cn/xzc168520/miniprogramtemplate.git"
} }
// new ci实例
const ci = require("miniprogram-ci");
ci.packNpmManually({
packageJsonPath: "./package.json",
miniprogramNpmDistDir: "../dist/"
});
This diff is collapsed.
{
"name": "package",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"miniprogram-ci": "^1.0.94",
"nmaxios": "^1.0.0"
}
}
{ {
"description": "项目配置文件", "description": "项目配置文件",
"miniprogramRoot": "dist/",
"packOptions": { "packOptions": {
"ignore": [] "ignore": []
}, },
...@@ -28,7 +29,6 @@ ...@@ -28,7 +29,6 @@
"disablePlugins": [], "disablePlugins": [],
"outputPath": "" "outputPath": ""
}, },
"enableEngineNative": false,
"bundle": false, "bundle": false,
"useIsolateContext": true, "useIsolateContext": true,
"useCompilerModule": true, "useCompilerModule": true,
...@@ -40,8 +40,8 @@ ...@@ -40,8 +40,8 @@
}, },
"compileType": "miniprogram", "compileType": "miniprogram",
"libVersion": "2.14.1", "libVersion": "2.14.1",
"appid": "wx238862d8fac4ce23", "appid": "",
"projectname": "miniprogram-1", "projectname": "",
"debugOptions": { "debugOptions": {
"hidedInDevtools": [] "hidedInDevtools": []
}, },
......
//app.js //app.js
const Request = require("./utils/request.js");
App({ App({
onLaunch: function() { onLaunch: function() {
// 初始化axios
Request.initAxios();
// 展示本地存储能力 // 展示本地存储能力
var logs = wx.getStorageSync("logs") || []; var logs = wx.getStorageSync("logs") || [];
logs.unshift(Date.now()); logs.unshift(Date.now());
...@@ -33,6 +37,35 @@ App({ ...@@ -33,6 +37,35 @@ App({
} }
}); });
}, },
_get(url, successCall, failCall) {
wx.showNavigationBarLoading();
Request.axiosGet(
url,
res => {
wx.hideNavigationBarLoading();
successCall && successCall(res);
},
err => {
wx.hideNavigationBarLoading();
failCall && failCall(err);
}
);
},
_post(url, data, successCall, failCall) {
wx.showNavigationBarLoading();
Request.axiosPost(
url,
data,
res => {
wx.hideNavigationBarLoading();
successCall && successCall(res);
},
err => {
wx.hideNavigationBarLoading();
failCall && failCall(err);
}
);
},
globalData: { globalData: {
userInfo: null userInfo: null
} }
......
...@@ -5,5 +5,4 @@ ...@@ -5,5 +5,4 @@
.container{ .container{
width: 100%; width: 100%;
height: 100vh; height: 100vh;
color: $tc;
} }
\ No newline at end of file
...@@ -11,9 +11,16 @@ Page({ ...@@ -11,9 +11,16 @@ Page({
}, },
//事件处理函数 //事件处理函数
bindViewTap: function() { bindViewTap: function() {
wx.navigateTo({ // 网络请求
url: "../test/index" app._get(
}); "page/home",
res => {
console.log("发起get请求-res", res);
},
err => {
console.log("发起get请求-err", err);
}
);
}, },
onLoad: function() { onLoad: function() {
if (app.globalData.userInfo) { if (app.globalData.userInfo) {
......
...@@ -5,14 +5,14 @@ import axios from "./request/axios"; ...@@ -5,14 +5,14 @@ import axios from "./request/axios";
* 初始化网络配置,会覆盖默认配置 * 初始化网络配置,会覆盖默认配置
*/ */
function initAxios() { function initAxios() {
const baseUrl = API_URL.host + "/index.php?s=/api/"; const baseUrl = API_URL.host;
const header = { const header = {
"content-type": "application/x-www-form-urlencoded; charset=UTF-8" "content-type": "application/x-www-form-urlencoded; charset=UTF-8"
}; };
const transformRequest = data => { const transformRequest = data => {
return { return {
/// 这是使用transformRequest给请求参数加上的字段 /// 这是使用transformRequest给请求参数加上的字段
wxapp_id: API_URL.uniacid, //transformRequest: API_URL.xxxx,
...data ...data
}; };
}; };
......
This diff is collapsed.
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