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

更新

parent 8bfe76ae
......@@ -15,3 +15,5 @@ dist
# Node.js
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 source diff could not be displayed because it is too large. You can view the blob instead.
{
"name": "miniprogram-template",
"version": "1.0.0",
"description": "gulp miniprogram",
"description": "",
"main": "index.js",
"author": "shelia",
"license": "MIT",
"scripts": {
"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": {
"autoprefixer": "^9.7.3",
"babel-eslint": "^8.2.1",
"del": "^5.1.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",
"babel-eslint": "^10.1.0",
"del": "^6.0.0",
"gulp": "^4.0.2",
"gulp-imagemin": "^6.2.0",
"gulp-imagemin": "^7.1.0",
"gulp-notify": "^3.2.0",
"gulp-plumber": "^1.2.1",
"gulp-postcss": "^8.0.0",
"gulp-rename": "^1.4.0",
"gulp-postcss": "^9.0.0",
"gulp-rename": "^2.0.0",
"gulp-replace": "^1.0.0",
"gulp-sass": "^4.0.2",
"gulp-sass": "^4.1.0",
"gulp-tap": "^2.0.0",
"miniprogram-automator": "^0.10.0",
"path": "^0.12.7",
"prettier": "^1.8.2",
"yargs": "^15.3.1"
},
"repository": "http://git.changein.cn/xzc168520/miniprogramtemplate.git"
"yargs": "^16.2.0"
}
}
// new ci实例
const ci = require("miniprogram-ci");
ci.packNpmManually({
packageJsonPath: "./package.json",
miniprogramNpmDistDir: "../dist/"
});
This source diff could not be displayed because it is too large. You can view the blob instead.
{
"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": "项目配置文件",
"miniprogramRoot": "dist/",
"packOptions": {
"ignore": []
},
......@@ -28,7 +29,6 @@
"disablePlugins": [],
"outputPath": ""
},
"enableEngineNative": false,
"bundle": false,
"useIsolateContext": true,
"useCompilerModule": true,
......@@ -40,8 +40,8 @@
},
"compileType": "miniprogram",
"libVersion": "2.14.1",
"appid": "wx238862d8fac4ce23",
"projectname": "miniprogram-1",
"appid": "",
"projectname": "",
"debugOptions": {
"hidedInDevtools": []
},
......
//app.js
const Request = require("./utils/request.js");
App({
onLaunch: function() {
// 初始化axios
Request.initAxios();
// 展示本地存储能力
var logs = wx.getStorageSync("logs") || [];
logs.unshift(Date.now());
......@@ -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: {
userInfo: null
}
......
......@@ -5,5 +5,4 @@
.container{
width: 100%;
height: 100vh;
color: $tc;
}
\ No newline at end of file
......@@ -11,9 +11,16 @@ Page({
},
//事件处理函数
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() {
if (app.globalData.userInfo) {
......
......@@ -5,14 +5,14 @@ import axios from "./request/axios";
* 初始化网络配置,会覆盖默认配置
*/
function initAxios() {
const baseUrl = API_URL.host + "/index.php?s=/api/";
const baseUrl = API_URL.host;
const header = {
"content-type": "application/x-www-form-urlencoded; charset=UTF-8"
};
const transformRequest = data => {
return {
/// 这是使用transformRequest给请求参数加上的字段
wxapp_id: API_URL.uniacid,
//transformRequest: API_URL.xxxx,
...data
};
};
......
This source diff could not be displayed because it is too large. You can view the blob instead.
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