gc_mobile 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -8,7 +8,7 @@
8
8
  ## 安装
9
9
 
10
10
  ```bash
11
- npm install gc_mobile--save
11
+ npm install gc_mobile --save
12
12
  ```
13
13
 
14
14
  ## 使用
@@ -34,19 +34,22 @@ http://192.168.1.43:8081/?corpId=ding013ea2dcb2eb81a5f2c783f7214b6d69
34
34
 
35
35
  4.测试环境配置代理(测试环境不支持跨域),方式如下:
36
36
 
37
- ```json
37
+ ```javascript
38
38
 
39
39
  vue-cli或vite代理配置
40
40
 
41
- proxy: {
42
- "/api": {
43
- "target": "https://test.ihotel.cn/gw/v1/platform-gcding/",
44
- "changeOrigin": true
41
+ {
42
+ "proxy": {
43
+ "/api": {
44
+ "target": "https://test.ihotel.cn/gw/v1/platform-gcding/",
45
+ "changeOrigin": true
46
+ }
45
47
  }
46
48
  }
49
+
47
50
  ```
48
51
 
49
- ```json
52
+ ```javascript
50
53
 
51
54
  uniapp的配置,打开manifest.json,切换到源码视图,加入代码
52
55
 
@@ -0,0 +1,24 @@
1
+ <script>
2
+ import mobile from "../../libs/main";
3
+ export default {
4
+ onLaunch: async function () {
5
+ const res = await mobile({
6
+ appCode: "DZ-TEST"
7
+ // apiPrefix: "http://www.baidu.com"
8
+ });
9
+ console.log("res", res.userInfo);
10
+ this.$store.commit("setUserInfo", res.userInfo);
11
+ console.log("App Launch");
12
+ },
13
+ onShow: function () {
14
+ console.log("App Show");
15
+ },
16
+ onHide: function () {
17
+ console.log("App Hide");
18
+ }
19
+ };
20
+ </script>
21
+
22
+ <style>
23
+ /*每个页面公共css */
24
+ </style>
@@ -0,0 +1,20 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <script>
6
+ var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') ||
7
+ CSS.supports('top: constant(a)'))
8
+ document.write(
9
+ '<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' +
10
+ (coverSupport ? ', viewport-fit=cover' : '') + '" />')
11
+ </script>
12
+ <title></title>
13
+ <!--preload-links-->
14
+ <!--app-context-->
15
+ </head>
16
+ <body>
17
+ <div id="app"><!--app-html--></div>
18
+ <script type="module" src="/main.js"></script>
19
+ </body>
20
+ </html>
@@ -0,0 +1,28 @@
1
+ import App from "./App";
2
+
3
+ import store from "./store";
4
+ Vue.prototype.$store = store;
5
+
6
+ // #ifndef VUE3
7
+ import Vue from "vue";
8
+ import "./uni.promisify.adaptor";
9
+ // Vue.prototype.$userInfo = "这是全局变量的初始值"; // 设置全局变量
10
+
11
+ Vue.config.productionTip = false;
12
+ App.mpType = "app";
13
+ const app = new Vue({
14
+ store,
15
+ ...App
16
+ });
17
+ app.$mount();
18
+ // #endif
19
+
20
+ // #ifdef VUE3
21
+ import { createSSRApp } from "vue";
22
+ export function createApp() {
23
+ const app = createSSRApp(App);
24
+ return {
25
+ app
26
+ };
27
+ }
28
+ // #endif
@@ -0,0 +1,83 @@
1
+ {
2
+ "name" : "dd",
3
+ "appid" : "",
4
+ "description" : "",
5
+ "versionName" : "1.0.0",
6
+ "versionCode" : "100",
7
+ "transformPx" : false,
8
+ "h5" : {
9
+ "devServer" : {
10
+ "disableHostCheck" : true,
11
+ "proxy" : {
12
+ "/api" : {
13
+ "target" : "https://test.ihotel.cn/gw/v1/platform-gcding/",
14
+ "changeOrigin" : true
15
+ }
16
+ }
17
+ }
18
+ },
19
+ /* 5+App特有相关 */
20
+ "app-plus" : {
21
+ "usingComponents" : true,
22
+ "nvueStyleCompiler" : "uni-app",
23
+ "compilerVersion" : 3,
24
+ "splashscreen" : {
25
+ "alwaysShowBeforeRender" : true,
26
+ "waiting" : true,
27
+ "autoclose" : true,
28
+ "delay" : 0
29
+ },
30
+ /* 模块配置 */
31
+ "modules" : {},
32
+ /* 应用发布信息 */
33
+ "distribute" : {
34
+ /* android打包配置 */
35
+ "android" : {
36
+ "permissions" : [
37
+ "<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
38
+ "<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
39
+ "<uses-permission android:name=\"android.permission.VIBRATE\"/>",
40
+ "<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
41
+ "<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
42
+ "<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
43
+ "<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
44
+ "<uses-permission android:name=\"android.permission.CAMERA\"/>",
45
+ "<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
46
+ "<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
47
+ "<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
48
+ "<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
49
+ "<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
50
+ "<uses-feature android:name=\"android.hardware.camera\"/>",
51
+ "<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
52
+ ]
53
+ },
54
+ /* ios打包配置 */
55
+ "ios" : {},
56
+ /* SDK配置 */
57
+ "sdkConfigs" : {}
58
+ }
59
+ },
60
+ /* 快应用特有相关 */
61
+ "quickapp" : {},
62
+ /* 小程序特有相关 */
63
+ "mp-weixin" : {
64
+ "appid" : "",
65
+ "setting" : {
66
+ "urlCheck" : false
67
+ },
68
+ "usingComponents" : true
69
+ },
70
+ "mp-alipay" : {
71
+ "usingComponents" : true
72
+ },
73
+ "mp-baidu" : {
74
+ "usingComponents" : true
75
+ },
76
+ "mp-toutiao" : {
77
+ "usingComponents" : true
78
+ },
79
+ "uniStatistics" : {
80
+ "enable" : false
81
+ },
82
+ "vueVersion" : "2"
83
+ }
@@ -0,0 +1,60 @@
1
+ <template>
2
+ <view class="content">
3
+ <image class="logo" src="/static/logo.png"></image>
4
+ <view class="text-area">
5
+ <text class="title">{{ title }}</text>
6
+
7
+ </view>
8
+ <view class="token">token:{{ userInfo.ucToken }}</View>
9
+ </view>
10
+ </template>
11
+
12
+ <script>
13
+ export default {
14
+ data() {
15
+ return {
16
+ title: "Hello"
17
+ };
18
+ },
19
+ computed: {
20
+ userInfo() {
21
+ return this.$store.state.userInfo
22
+ }
23
+ },
24
+ onLoad() {},
25
+ methods: {}
26
+ };
27
+ </script>
28
+
29
+ <style>
30
+ .content {
31
+ display: flex;
32
+ flex-direction: column;
33
+ align-items: center;
34
+ justify-content: center;
35
+ }
36
+
37
+ .logo {
38
+ height: 200rpx;
39
+ width: 200rpx;
40
+ margin-top: 200rpx;
41
+ margin-left: auto;
42
+ margin-right: auto;
43
+ margin-bottom: 50rpx;
44
+ }
45
+
46
+ .text-area {
47
+ display: flex;
48
+ justify-content: center;
49
+ }
50
+
51
+ .title {
52
+ font-size: 36rpx;
53
+ color: #8f8f94;
54
+ }
55
+
56
+ .token {
57
+ width: 80%;
58
+ margin-left:10%
59
+ }
60
+ </style>
@@ -0,0 +1,17 @@
1
+ {
2
+ "pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
3
+ {
4
+ "path": "pages/index/index",
5
+ "style": {
6
+ "navigationBarTitleText": "uni-app"
7
+ }
8
+ }
9
+ ],
10
+ "globalStyle": {
11
+ "navigationBarTextStyle": "black",
12
+ "navigationBarTitleText": "uni-app",
13
+ "navigationBarBackgroundColor": "#F8F8F8",
14
+ "backgroundColor": "#F8F8F8"
15
+ },
16
+ "uniIdRouter": {}
17
+ }
Binary file
@@ -0,0 +1,22 @@
1
+ // 页面路径:store/index.js
2
+ import Vue from 'vue'
3
+ import Vuex from 'vuex'
4
+
5
+ Vue.use(Vuex); //vue的插件机制
6
+
7
+ //Vuex.Store 构造器选项
8
+ const store = new Vuex.Store({
9
+ state: {
10
+ userInfo: {
11
+
12
+ }
13
+ },
14
+ mutations: {
15
+ setUserInfo(state, userInfo) {
16
+ // 变更状态
17
+ console.log("setUserInfo",userInfo)
18
+ state.userInfo = userInfo
19
+ }
20
+ }
21
+ })
22
+ export default store
@@ -0,0 +1,10 @@
1
+ uni.addInterceptor({
2
+ returnValue (res) {
3
+ if (!(!!res && (typeof res === "object" || typeof res === "function") && typeof res.then === "function")) {
4
+ return res;
5
+ }
6
+ return new Promise((resolve, reject) => {
7
+ res.then((res) => res[0] ? reject(res[0]) : resolve(res[1]));
8
+ });
9
+ },
10
+ });
@@ -0,0 +1,76 @@
1
+ /**
2
+ * 这里是uni-app内置的常用样式变量
3
+ *
4
+ * uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量
5
+ * 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App
6
+ *
7
+ */
8
+
9
+ /**
10
+ * 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能
11
+ *
12
+ * 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
13
+ */
14
+
15
+ /* 颜色变量 */
16
+
17
+ /* 行为相关颜色 */
18
+ $uni-color-primary: #007aff;
19
+ $uni-color-success: #4cd964;
20
+ $uni-color-warning: #f0ad4e;
21
+ $uni-color-error: #dd524d;
22
+
23
+ /* 文字基本颜色 */
24
+ $uni-text-color:#333;//基本色
25
+ $uni-text-color-inverse:#fff;//反色
26
+ $uni-text-color-grey:#999;//辅助灰色,如加载更多的提示信息
27
+ $uni-text-color-placeholder: #808080;
28
+ $uni-text-color-disable:#c0c0c0;
29
+
30
+ /* 背景颜色 */
31
+ $uni-bg-color:#ffffff;
32
+ $uni-bg-color-grey:#f8f8f8;
33
+ $uni-bg-color-hover:#f1f1f1;//点击状态颜色
34
+ $uni-bg-color-mask:rgba(0, 0, 0, 0.4);//遮罩颜色
35
+
36
+ /* 边框颜色 */
37
+ $uni-border-color:#c8c7cc;
38
+
39
+ /* 尺寸变量 */
40
+
41
+ /* 文字尺寸 */
42
+ $uni-font-size-sm:12px;
43
+ $uni-font-size-base:14px;
44
+ $uni-font-size-lg:16px;
45
+
46
+ /* 图片尺寸 */
47
+ $uni-img-size-sm:20px;
48
+ $uni-img-size-base:26px;
49
+ $uni-img-size-lg:40px;
50
+
51
+ /* Border Radius */
52
+ $uni-border-radius-sm: 2px;
53
+ $uni-border-radius-base: 3px;
54
+ $uni-border-radius-lg: 6px;
55
+ $uni-border-radius-circle: 50%;
56
+
57
+ /* 水平间距 */
58
+ $uni-spacing-row-sm: 5px;
59
+ $uni-spacing-row-base: 10px;
60
+ $uni-spacing-row-lg: 15px;
61
+
62
+ /* 垂直间距 */
63
+ $uni-spacing-col-sm: 4px;
64
+ $uni-spacing-col-base: 8px;
65
+ $uni-spacing-col-lg: 12px;
66
+
67
+ /* 透明度 */
68
+ $uni-opacity-disabled: 0.3; // 组件禁用态的透明度
69
+
70
+ /* 文章场景相关 */
71
+ $uni-color-title: #2C405A; // 文章标题颜色
72
+ $uni-font-size-title:20px;
73
+ $uni-color-subtitle: #555555; // 二级标题颜色
74
+ $uni-font-size-subtitle:26px;
75
+ $uni-color-paragraph: #3F536E; // 文章段落颜色
76
+ $uni-font-size-paragraph:15px;
package/libs/main.js ADDED
@@ -0,0 +1,87 @@
1
+ import f from "lodash-es";
2
+ import * as o from "dingtalk-jsapi";
3
+ import g from "qs";
4
+ import h from "axios";
5
+ const s = window.navigator.userAgent.toLowerCase();
6
+ let a = {
7
+ code: "",
8
+ name: "未知"
9
+ };
10
+ function w() {
11
+ return typeof window < "u" && typeof document < "u" && typeof document.querySelector == "function" && typeof navigator < "u" && typeof XMLHttpRequest == "function";
12
+ }
13
+ const v = [
14
+ {
15
+ code: "weixin",
16
+ name: "微信",
17
+ value: /MicroMessenger/i.test(s)
18
+ },
19
+ {
20
+ code: "wxmp",
21
+ name: "微信小程序",
22
+ value: /miniProgram/i.test(s) || window.__wxjs_environment === "miniprogram"
23
+ },
24
+ {
25
+ code: "dd",
26
+ name: "钉钉",
27
+ value: /DingTalk/i.test(s)
28
+ }
29
+ ], y = (e) => e.value, m = f.find(v, y);
30
+ m ? a = m : w() && (a = {
31
+ code: "h5",
32
+ name: "H5"
33
+ });
34
+ const I = a, x = (e) => e == "dev" ? "https://test.ihotel.cn/gw/v1/platform-gcding/" : e == "prod" ? "https://smart.ihotel.cn/gw/v1/platform-gcding" : e || "", q = g.parse(location.search, { ignoreQueryPrefix: !0 }), r = f.get(q, "corpId"), C = async ({ appCode: e, apiPrefix: n }) => {
35
+ const i = x(n);
36
+ return new Promise(async (c) => {
37
+ var d, u, l;
38
+ if (r) {
39
+ const { code: p } = await o.getAuthCode({
40
+ corpId: r
41
+ }), t = await h.post(
42
+ `${i}/api/auth/queryAuthNoExternalCompatible`,
43
+ {
44
+ appCode: e,
45
+ authCode: p,
46
+ corpId: r
47
+ }
48
+ );
49
+ t.data && ((d = t.data) == null ? void 0 : d.result) === 0 ? c({ userInfo: (u = t == null ? void 0 : t.data) == null ? void 0 : u.retVal, res: t }) : (o.alert({
50
+ title: (l = t == null ? void 0 : t.data) == null ? void 0 : l.msg
51
+ }), c({ res: t }));
52
+ } else
53
+ o.alert({
54
+ title: "未配置参数:corpId"
55
+ });
56
+ });
57
+ }, E = {
58
+ login: C,
59
+ dd: o
60
+ }, M = () => new Promise((e) => {
61
+ e({
62
+ userInfo: {
63
+ ucToken: "When you see this,it means it's under development."
64
+ }
65
+ });
66
+ }), P = {
67
+ login: M
68
+ }, _ = {
69
+ dd: E,
70
+ h5: P
71
+ };
72
+ class $ {
73
+ constructor(n) {
74
+ this.config = n, this.env = I, this.js = _[this.env.code], this.userInfo = null;
75
+ }
76
+ async init() {
77
+ const n = await this.js.login(this.config), { userInfo: i } = n;
78
+ this.userInfo = i;
79
+ }
80
+ }
81
+ async function H(e) {
82
+ const n = new $(e);
83
+ return await n.init(), n;
84
+ }
85
+ export {
86
+ H as default
87
+ };
@@ -0,0 +1 @@
1
+ (function(n,s){typeof exports=="object"&&typeof module<"u"?module.exports=s(require("lodash-es"),require("dingtalk-jsapi"),require("qs"),require("axios")):typeof define=="function"&&define.amd?define(["lodash-es","dingtalk-jsapi","qs","axios"],s):(n=typeof globalThis<"u"?globalThis:n||self,n.Main=s(n._,n.dd$1,n.qs,n.axios))})(this,function(n,s,g,h){"use strict";function w(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const i in e)if(i!=="default"){const r=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(t,i,r.get?r:{enumerable:!0,get:()=>e[i]})}}return t.default=e,Object.freeze(t)}const a=w(s),c=window.navigator.userAgent.toLowerCase();let d={code:"",name:"未知"};function v(){return typeof window<"u"&&typeof document<"u"&&typeof document.querySelector=="function"&&typeof navigator<"u"&&typeof XMLHttpRequest=="function"}const y=[{code:"weixin",name:"微信",value:/MicroMessenger/i.test(c)},{code:"wxmp",name:"微信小程序",value:/miniProgram/i.test(c)||window.__wxjs_environment==="miniprogram"},{code:"dd",name:"钉钉",value:/DingTalk/i.test(c)}],q=e=>e.value,f=n.find(y,q);f?d=f:v()&&(d={code:"h5",name:"H5"});const j=d,x=e=>e=="dev"?"https://test.ihotel.cn/gw/v1/platform-gcding/":e=="prod"?"https://smart.ihotel.cn/gw/v1/platform-gcding":e||"",I=g.parse(location.search,{ignoreQueryPrefix:!0}),u=n.get(I,"corpId"),b={dd:{login:async({appCode:e,apiPrefix:t})=>{const i=x(t);return new Promise(async r=>{var l,p,m;if(u){const{code:_}=await a.getAuthCode({corpId:u}),o=await h.post(`${i}/api/auth/queryAuthNoExternalCompatible`,{appCode:e,authCode:_,corpId:u});o.data&&((l=o.data)==null?void 0:l.result)===0?r({userInfo:(p=o==null?void 0:o.data)==null?void 0:p.retVal,res:o}):(a.alert({title:(m=o==null?void 0:o.data)==null?void 0:m.msg}),r({res:o}))}else a.alert({title:"未配置参数:corpId"})})},dd:a},h5:{login:()=>new Promise(e=>{e({userInfo:{ucToken:"When you see this,it means it's under development."}})})}};class M{constructor(t){this.config=t,this.env=j,this.js=b[this.env.code],this.userInfo=null}async init(){const t=await this.js.login(this.config),{userInfo:i}=t;this.userInfo=i}}async function P(e){const t=new M(e);return await t.init(),t}return P});
package/package.json CHANGED
@@ -1,10 +1,12 @@
1
1
  {
2
2
  "name": "gc_mobile",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "type": "module",
5
5
  "files": [
6
- "dist",
7
- "index.d.ts"
6
+ "example",
7
+ "libs",
8
+ "src",
9
+ "vite.config.js"
8
10
  ],
9
11
  "main": "./libs/main.umd.cjs",
10
12
  "module": "./libs/main.js",
package/src/index.js ADDED
@@ -0,0 +1,21 @@
1
+ import env from "./lib/env";
2
+ import modules from "./modules";
3
+
4
+ class Mobile {
5
+ constructor(config) {
6
+ this.config = config;
7
+ this.env = env;
8
+ this.js = modules[this.env.code];
9
+ this.userInfo = null;
10
+ }
11
+ async init() {
12
+ const res = await this.js.login(this.config);
13
+ const { userInfo } = res;
14
+ this.userInfo = userInfo;
15
+ }
16
+ }
17
+ export default async function (config) {
18
+ const mobile = new Mobile(config);
19
+ await mobile.init();
20
+ return mobile;
21
+ }
package/src/lib/api.js ADDED
@@ -0,0 +1,13 @@
1
+ export const prefix = (prefix) => {
2
+ if (prefix == "dev") {
3
+ return "https://test.ihotel.cn/gw/v1/platform-gcding/";
4
+ } else if (prefix == "prod") {
5
+ return "https://smart.ihotel.cn/gw/v1/platform-gcding";
6
+ } else {
7
+ return prefix ? prefix : "";
8
+ }
9
+ };
10
+
11
+ export default {
12
+ prefix
13
+ };
package/src/lib/env.js ADDED
@@ -0,0 +1,52 @@
1
+ import _ from "lodash-es";
2
+
3
+ const ua = window.navigator.userAgent.toLowerCase();
4
+ let env = {
5
+ code: "",
6
+ name: "未知"
7
+ };
8
+ function isNormalH5Environment() {
9
+ // 检查window对象是否存在,以及一些H5特有的API,如document.querySelector等
10
+ return (
11
+ typeof window !== "undefined" &&
12
+ typeof document !== "undefined" &&
13
+ typeof document.querySelector === "function" &&
14
+ typeof navigator !== "undefined" &&
15
+ typeof XMLHttpRequest === "function"
16
+ );
17
+ }
18
+
19
+ const envs = [
20
+ {
21
+ code: "weixin",
22
+ name: "微信",
23
+ value: /MicroMessenger/i.test(ua)
24
+ },
25
+ {
26
+ code: "wxmp",
27
+ name: "微信小程序",
28
+ value:
29
+ /miniProgram/i.test(ua) || window.__wxjs_environment === "miniprogram"
30
+ },
31
+ {
32
+ code: "dd",
33
+ name: "钉钉",
34
+ value: /DingTalk/i.test(ua)
35
+ }
36
+ ];
37
+
38
+ const isEnv = (val) => val.value;
39
+
40
+ const findEnv = _.find(envs, isEnv);
41
+
42
+ if (findEnv) {
43
+ env = findEnv;
44
+ } else {
45
+ if (isNormalH5Environment()) {
46
+ env = {
47
+ code: "h5",
48
+ name: "H5"
49
+ };
50
+ }
51
+ }
52
+ export default env;
@@ -0,0 +1,43 @@
1
+ import * as dd from "dingtalk-jsapi";
2
+ import qs from "qs";
3
+ import _, { reject } from "lodash-es";
4
+ import axios from "axios";
5
+ import { prefix } from "../lib/api";
6
+
7
+ const query = qs.parse(location.search, { ignoreQueryPrefix: true });
8
+ const corpId = _.get(query, "corpId");
9
+ export const login = async ({ appCode, apiPrefix }) => {
10
+ const api = prefix(apiPrefix);
11
+ return new Promise(async (resolve) => {
12
+ if (corpId) {
13
+ const { code: authCode } = await dd.getAuthCode({
14
+ corpId
15
+ });
16
+ const res = await axios.post(
17
+ `${api}/api/auth/queryAuthNoExternalCompatible`,
18
+ {
19
+ appCode,
20
+ authCode,
21
+ corpId
22
+ }
23
+ );
24
+ if (res.data && res.data?.result === 0) {
25
+ resolve({ userInfo: res?.data?.retVal, res });
26
+ } else {
27
+ dd.alert({
28
+ title: res?.data?.msg
29
+ });
30
+ resolve({ res });
31
+ }
32
+ } else {
33
+ dd.alert({
34
+ title: "未配置参数:corpId"
35
+ });
36
+ }
37
+ });
38
+ };
39
+
40
+ export default {
41
+ login,
42
+ dd
43
+ };
@@ -0,0 +1,15 @@
1
+ // 普通h5环境
2
+
3
+ const login = () => {
4
+ return new Promise((resolve) => {
5
+ resolve({
6
+ userInfo: {
7
+ ucToken: "When you see this,it means it's under development."
8
+ }
9
+ });
10
+ });
11
+ };
12
+
13
+ export default {
14
+ login
15
+ };
@@ -0,0 +1,7 @@
1
+ import dd from "./dd.js";
2
+ import h5 from "./h5.js";
3
+
4
+ export default {
5
+ dd,
6
+ h5
7
+ };
package/vite.config.js ADDED
@@ -0,0 +1,42 @@
1
+ import { defineConfig } from "vite";
2
+ import path from "path";
3
+
4
+ export default defineConfig(({ mode }) => {
5
+ return {
6
+ resolve: {
7
+ alias: {
8
+ "~/": `${path.resolve(__dirname, "src")}/`
9
+ }
10
+ },
11
+ server: {
12
+ host: "0.0.0.0",
13
+ port: 3001,
14
+ proxy: {
15
+ "/api": {
16
+ target: "https://test.ihotel.cn/gw/v1/platform-gcding/",
17
+ changeOrigin: true
18
+ }
19
+ }
20
+ },
21
+ build: {
22
+ outDir: "libs",
23
+ lib: {
24
+ entry: "./src",
25
+ name: "Main",
26
+ fileName: "main"
27
+ },
28
+ rollupOptions: {
29
+ external:
30
+ mode === "production"
31
+ ? [
32
+ // 确保外部化处理那些你不想打包进库的依赖
33
+ "axios",
34
+ "lodash-es",
35
+ "dingtalk-jsapi",
36
+ "qs"
37
+ ]
38
+ : []
39
+ }
40
+ }
41
+ };
42
+ });