mirror of
https://gitee.com/beijing_hongye_huicheng/lilishop-uniapp.git
synced 2026-06-21 17:30:13 +08:00
提交 all-in-one H5 本地适配
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -11,4 +11,5 @@ node_modules/
|
||||
.hbuilderx/launch.json
|
||||
.project.config.json
|
||||
.project.private.config.json
|
||||
|
||||
.env.local
|
||||
.env.*.local
|
||||
|
||||
7
babel.config.js
Normal file
7
babel.config.js
Normal file
@@ -0,0 +1,7 @@
|
||||
module.exports = {
|
||||
presets: ['@vue/cli-plugin-babel/preset'],
|
||||
plugins: [
|
||||
'@babel/plugin-proposal-optional-chaining',
|
||||
'@babel/plugin-proposal-class-properties',
|
||||
],
|
||||
};
|
||||
@@ -1,22 +1,22 @@
|
||||
/**
|
||||
* base : 基础业务API
|
||||
* buyer : 买家API
|
||||
*/
|
||||
// 开发环境
|
||||
const dev = {
|
||||
im: "https://im-api.pickmall.cn",
|
||||
common: "https://common-api.pickmall.cn",
|
||||
buyer: "https://buyer-api.pickmall.cn",
|
||||
// common: "http://192.168.0.113:8890",
|
||||
// buyer: "http://192.168.0.113:8888",
|
||||
// im: "http://192.168.0.113:8885",
|
||||
};
|
||||
// 生产环境
|
||||
const prod = {
|
||||
im: "https://im-api.pickmall.cn",
|
||||
common: "https://common-api.pickmall.cn",
|
||||
buyer: "https://buyer-api.pickmall.cn",
|
||||
};
|
||||
/**
|
||||
* base : 基础业务API
|
||||
* buyer : 买家API
|
||||
*/
|
||||
const localApiBase = process.env.VUE_APP_API_BASE_URL;
|
||||
const localImBase = process.env.VUE_APP_IM_API_BASE_URL || localApiBase;
|
||||
|
||||
// 开发环境优先读取一键启动脚本生成的 .env.development.local。
|
||||
const dev = {
|
||||
im: localImBase || "https://im-api.pickmall.cn",
|
||||
common: localApiBase || "https://common-api.pickmall.cn",
|
||||
buyer: localApiBase || "https://buyer-api.pickmall.cn",
|
||||
};
|
||||
// 生产环境保持原有线上默认值,构建时也允许通过环境变量显式覆盖。
|
||||
const prod = {
|
||||
im: localImBase || "https://im-api.pickmall.cn",
|
||||
common: localApiBase || "https://common-api.pickmall.cn",
|
||||
buyer: localApiBase || "https://buyer-api.pickmall.cn",
|
||||
};
|
||||
|
||||
//默认生产环境
|
||||
let api = dev;
|
||||
|
||||
@@ -1,19 +1,21 @@
|
||||
const name = "lilishop"; //全局商城name
|
||||
const schemeName = "lilishop"; //唤醒app需要的schemeName
|
||||
const wapUrl = process.env.VUE_APP_WAP_URL || "https://m-b2b2c.pickmall.cn";
|
||||
|
||||
export default {
|
||||
name: name,
|
||||
schemeLink: `${schemeName}://`, //唤起app地址
|
||||
downloadLink: "https://pickmall.cn/download-page/index.html", //下载地址,下载app的地址
|
||||
shareLink: "https://m-b2b2c.pickmall.cn", //分享地址,也就是在h5中默认的复制地址
|
||||
shareLink: wapUrl, //分享地址,也就是在h5中默认的复制地址
|
||||
appid: "wx6f10f29075dc1b0b", //小程序唯一凭证,即 AppID,可在「微信公众平台 - 设置 - 开发设置」页中获得。(需要已经成为开发者,且帐号没有异常状态)
|
||||
aMapKey: "1f78544934b66c9fbc0104117f663973", //在高德中申请Web服务key
|
||||
scanAuthNavigation: ["https://m-b2b2c.pickmall.cn/"], //扫码认证跳转域名配置 会根据此处配置的路由进行跳转
|
||||
scanAuthNavigation: [`${wapUrl}/`], //扫码认证跳转域名配置 会根据此处配置的路由进行跳转
|
||||
iosAppId: "id1564638363", //AppStore的应用地址id 具体在分享->拷贝链接中查看
|
||||
logo: "https://lilishop-oss.oss-cn-beijing.aliyuncs.com/4c864e133c2944efad1f7282ac8a3b9e.png", //logo地址
|
||||
customerServiceMobile: "13161366885", //客服电话
|
||||
customerServiceEmail: "lili@lili.com", //客服邮箱
|
||||
imWebSrc: "https://im.pickmall.cn", //IM地址
|
||||
baseWsUrl: "wss://im-api.pickmall.cn/lili/webSocket", // IM WS 地址
|
||||
imWebSrc: process.env.VUE_APP_IM_WEB_URL || "https://im.pickmall.cn", //IM地址
|
||||
baseWsUrl: process.env.VUE_APP_IM_WS_URL || "wss://im-api.pickmall.cn/lili/webSocket", // IM WS 地址
|
||||
enableGetClipboard: false, //是否启用粘贴板获取 scanAuthNavigation 中的链接,如果匹配则会跳转到对应页面
|
||||
enableMiniBarStartUpApp: true, //是否在h5中右侧浮空按钮点击启动app
|
||||
/**
|
||||
|
||||
17
main.js
17
main.js
@@ -3,12 +3,17 @@ import App from "./App";
|
||||
import * as filters from "./utils/filters.js"; // global filter
|
||||
import uView from "uview-ui";
|
||||
import store from "./store";
|
||||
import config from '@/config/config';
|
||||
import airBtn from "@/components/m-airbtn/index.vue";
|
||||
import socketIO from './pages/mine/im/socket';
|
||||
/**
|
||||
* 仅在h5中显示唤醒app功能
|
||||
* 在h5页面手动挂载
|
||||
import config from '@/config/config';
|
||||
import airBtn from "@/components/m-airbtn/index.vue";
|
||||
import socketIO from './pages/mine/im/socket';
|
||||
|
||||
// #ifdef H5
|
||||
// uni-app H5 框架基础样式在当前构建链路中未自动注入,显式引入避免 tabbar/page 基础布局丢失。
|
||||
import "@dcloudio/uni-h5/dist/index.css";
|
||||
// #endif
|
||||
/**
|
||||
* 仅在h5中显示唤醒app功能
|
||||
* 在h5页面手动挂载
|
||||
*
|
||||
*/
|
||||
// #ifdef H5
|
||||
|
||||
@@ -223,7 +223,7 @@
|
||||
},
|
||||
"router" : {
|
||||
"mode" : "history",
|
||||
"base" : ""
|
||||
"base" : "/h5/"
|
||||
},
|
||||
"sdkConfigs" : {
|
||||
"maps" : {}
|
||||
|
||||
20385
package-lock.json
generated
Normal file
20385
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
63
package.json
Normal file
63
package.json
Normal file
@@ -0,0 +1,63 @@
|
||||
{
|
||||
"name": "lilishop-uniapp",
|
||||
"version": "4.5.3",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev:h5": "cross-env NODE_ENV=development UNI_INPUT_DIR=. UNI_OUTPUT_DIR=unpackage/dist/dev/h5 UNI_PLATFORM=h5 vue-cli-service uni-serve --host 0.0.0.0 --port 10001",
|
||||
"build:h5": "cross-env NODE_ENV=production UNI_INPUT_DIR=. UNI_OUTPUT_DIR=unpackage/dist/build/h5 UNI_PLATFORM=h5 vue-cli-service uni-build",
|
||||
"dev:mp-weixin": "cross-env NODE_ENV=development UNI_INPUT_DIR=. UNI_OUTPUT_DIR=unpackage/dist/dev/mp-weixin UNI_PLATFORM=mp-weixin vue-cli-service uni-build --watch",
|
||||
"build:mp-weixin": "cross-env NODE_ENV=production UNI_INPUT_DIR=. UNI_OUTPUT_DIR=unpackage/dist/build/mp-weixin UNI_PLATFORM=mp-weixin vue-cli-service uni-build",
|
||||
"build:app-plus": "cross-env NODE_ENV=production UNI_INPUT_DIR=. UNI_OUTPUT_DIR=unpackage/dist/build/app-plus UNI_PLATFORM=app-plus vue-cli-service uni-build"
|
||||
},
|
||||
"dependencies": {
|
||||
"@dcloudio/uni-app": "2.0.2-5000720260410001",
|
||||
"@dcloudio/uni-app-plus": "2.0.2-5000720260410001",
|
||||
"@dcloudio/uni-h5": "2.0.2-5000720260410001",
|
||||
"@dcloudio/uni-i18n": "2.0.2-5000720260410001",
|
||||
"@dcloudio/uni-mp-360": "2.0.2-5000720260410001",
|
||||
"@dcloudio/uni-mp-alipay": "2.0.2-5000720260410001",
|
||||
"@dcloudio/uni-mp-baidu": "2.0.2-5000720260410001",
|
||||
"@dcloudio/uni-mp-harmony": "2.0.2-5000720260410001",
|
||||
"@dcloudio/uni-mp-jd": "2.0.2-5000720260410001",
|
||||
"@dcloudio/uni-mp-kuaishou": "2.0.2-5000720260410001",
|
||||
"@dcloudio/uni-mp-lark": "2.0.2-5000720260410001",
|
||||
"@dcloudio/uni-mp-qq": "2.0.2-5000720260410001",
|
||||
"@dcloudio/uni-mp-weixin": "2.0.2-5000720260410001",
|
||||
"@dcloudio/uni-mp-toutiao": "2.0.2-5000720260410001",
|
||||
"@dcloudio/uni-mp-vue": "2.0.2-5000720260410001",
|
||||
"@dcloudio/uni-mp-xhs": "2.0.2-5000720260410001",
|
||||
"@dcloudio/uni-quickapp-native": "2.0.2-5000720260410001",
|
||||
"@dcloudio/uni-quickapp-webview": "2.0.2-5000720260410001",
|
||||
"@dcloudio/uni-stacktracey": "2.0.2-5000720260410001",
|
||||
"@dcloudio/uni-stat": "2.0.2-5000720260410001",
|
||||
"@vue/shared": "^3.0.0",
|
||||
"flyio": "^0.6.2",
|
||||
"uview-ui": "^1.8.8",
|
||||
"vue": "2.6.14",
|
||||
"vuex": "3.6.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@dcloudio/uni-cli-i18n": "2.0.2-5000720260410001",
|
||||
"@dcloudio/uni-cli-shared": "2.0.2-5000720260410001",
|
||||
"@dcloudio/uni-migration": "2.0.2-5000720260410001",
|
||||
"@dcloudio/uni-template-compiler": "2.0.2-5000720260410001",
|
||||
"@dcloudio/vue-cli-plugin-hbuilderx": "2.0.2-5000720260410001",
|
||||
"@dcloudio/vue-cli-plugin-uni": "2.0.2-5000720260410001",
|
||||
"@dcloudio/vue-cli-plugin-uni-optimize": "2.0.2-5000720260410001",
|
||||
"@dcloudio/webpack-uni-mp-loader": "2.0.2-5000720260410001",
|
||||
"@dcloudio/webpack-uni-pages-loader": "2.0.2-5000720260410001",
|
||||
"@vue/cli-plugin-babel": "4.5.19",
|
||||
"@vue/cli-service": "4.5.19",
|
||||
"@babel/plugin-proposal-class-properties": "7.18.6",
|
||||
"@babel/plugin-proposal-optional-chaining": "7.21.0",
|
||||
"autoprefixer": "9.8.8",
|
||||
"babel-plugin-import": "^1.11.0",
|
||||
"copy-webpack-plugin": "5.1.2",
|
||||
"cross-env": "7.0.3",
|
||||
"html-webpack-plugin": "3.2.0",
|
||||
"sass": "1.69.5",
|
||||
"sass-loader": "8.0.2",
|
||||
"vue-template-compiler": "2.6.14",
|
||||
"webpack": "4.46.0"
|
||||
}
|
||||
}
|
||||
@@ -368,12 +368,12 @@ export default {
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
/deep/ .u-cell__value {
|
||||
::v-deep .u-cell__value {
|
||||
flex: 1.6;
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
/deep/ .u-cell__value-text {
|
||||
::v-deep .u-cell__value-text {
|
||||
white-space: normal;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
36
postcss.config.js
Normal file
36
postcss.config.js
Normal file
@@ -0,0 +1,36 @@
|
||||
function requireUniPostcss() {
|
||||
const Module = require('module');
|
||||
const path = require('path');
|
||||
const postcssPath = require.resolve('@vue/cli-service/node_modules/postcss');
|
||||
const postcssPackagePath = require.resolve('@vue/cli-service/node_modules/postcss/package.json');
|
||||
const uniPostcssPath = path.normalize(
|
||||
require.resolve('@dcloudio/vue-cli-plugin-uni/packages/postcss')
|
||||
);
|
||||
const originalResolveFilename = Module._resolveFilename;
|
||||
|
||||
Module._resolveFilename = function resolvePostcss(request, parent, isMain, options) {
|
||||
const parentFile = parent && parent.filename ? path.normalize(parent.filename) : '';
|
||||
if (parentFile === uniPostcssPath) {
|
||||
if (request === 'postcss') {
|
||||
return postcssPath;
|
||||
}
|
||||
if (request === 'postcss/package.json') {
|
||||
return postcssPackagePath;
|
||||
}
|
||||
}
|
||||
return originalResolveFilename.call(this, request, parent, isMain, options);
|
||||
};
|
||||
|
||||
try {
|
||||
return require('@dcloudio/vue-cli-plugin-uni/packages/postcss');
|
||||
} finally {
|
||||
Module._resolveFilename = originalResolveFilename;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
plugins: [
|
||||
requireUniPostcss()(),
|
||||
require('autoprefixer')(),
|
||||
],
|
||||
};
|
||||
@@ -233,9 +233,9 @@ function navigationToBack(type) {
|
||||
* 计算当前时间到第二天0点的倒计时[秒]
|
||||
* @returns {number}
|
||||
*/
|
||||
export function theNextDayTime() {
|
||||
const nowDate = new Date();
|
||||
const time =
|
||||
export function theNextDayTime() {
|
||||
const nowDate = new Date();
|
||||
const time =
|
||||
new Date(
|
||||
nowDate.getFullYear(),
|
||||
nowDate.getMonth(),
|
||||
@@ -243,17 +243,21 @@ export function theNextDayTime() {
|
||||
0,
|
||||
0,
|
||||
0
|
||||
).getTime() - nowDate.getTime();
|
||||
return parseInt(time / 1000);
|
||||
}
|
||||
module.exports = {
|
||||
unixToDate,
|
||||
dateToUnix,
|
||||
formatPrice,
|
||||
).getTime() - nowDate.getTime();
|
||||
return parseInt(time / 1000);
|
||||
}
|
||||
|
||||
const Foundation = {
|
||||
unixToDate,
|
||||
dateToUnix,
|
||||
formatPrice,
|
||||
secrecyMobile,
|
||||
randomString,
|
||||
countTimeDown,
|
||||
theNextDayTime,
|
||||
whetherNavigate,
|
||||
checkBankno,
|
||||
};
|
||||
whetherNavigate,
|
||||
checkBankno,
|
||||
};
|
||||
|
||||
// uni-app H5 的 webpack 模块包装会把 CommonJS exports 标记为只读,使用 ES 默认导出兼容现有默认导入。
|
||||
export default Foundation;
|
||||
|
||||
@@ -241,10 +241,7 @@
|
||||
uuid._whatwgRNG = _whatwgRNG;
|
||||
|
||||
|
||||
if (('undefined' !== typeof module) && module.exports) {
|
||||
// Publish as node.js module
|
||||
module.exports = uuid;
|
||||
} else if (typeof define === 'function' && define.amd) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// Publish as AMD module
|
||||
define(function() { return uuid; });
|
||||
} else {
|
||||
@@ -259,4 +256,7 @@
|
||||
|
||||
_window.uuid = uuid;
|
||||
}
|
||||
})('undefined' !== typeof window ? window : null);
|
||||
})('undefined' !== typeof window ? window : ('undefined' !== typeof globalThis ? globalThis : {}));
|
||||
|
||||
// uni-app H5 的 webpack 包装会把 CommonJS exports 标记为只读,避免使用 module.exports 重新赋值。
|
||||
export default ('undefined' !== typeof globalThis ? globalThis.uuid : undefined);
|
||||
|
||||
Reference in New Issue
Block a user