dai-vue-temp-w

f

2022/4/25 8:59:25

更改列表

.babelrc 4(+4 -0)

.gitignore 4(+4 -0)

.prettierrc 16(+16 -0)

build/build.js 3(+3 -0)

build/config.js 22(+22 -0)

build/dev.js 3(+3 -0)

desktop.ini 6(+6 -0)

main/favicon.ico 0(+0 -0)

main/index.html 20(+20 -0)

main/index.js 40(+40 -0)

main/interceptor.js 62(+62 -0)

main/modules.js 2(+2 -0)

main/store.js 20(+20 -0)

main/style.less 2(+2 -0)

package.json 16(+16 -0)

src/api.js 19(+19 -0)

src/index.js 8(+8 -0)

src/page/home.vue 28(+28 -0)

src/routes.js 2(+2 -0)

types/type.d.ts 154(+154 -0)

详细信息

.babelrc 4(+4 -0)

diff --git a/.babelrc b/.babelrc
new file mode 100644
index 0000000..3364bf8
--- /dev/null
+++ b/.babelrc
@@ -0,0 +1,4 @@
+{
+    "presets": ["@babel/preset-env"],
+    "plugins": ["@babel/plugin-transform-runtime", "@babel/plugin-proposal-class-properties"]
+}

.gitignore 4(+4 -0)

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..8a8eb06
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,4 @@
+node_modules/
+dist/
+package-lock.json
+.vscode/
\ No newline at end of file

.prettierrc 16(+16 -0)

diff --git a/.prettierrc b/.prettierrc
new file mode 100644
index 0000000..6c1a4ff
--- /dev/null
+++ b/.prettierrc
@@ -0,0 +1,16 @@
+{
+    "printWidth": 120,
+    "tabWidth": 4,
+    "semi": true,
+    "singleQuote": true,
+    "trailingComma": "none",
+    "bracketSpacing": true,
+    "jsxBracketSameLine": false,
+    "arrowParens": "always",
+    "requirePragma": false,
+    "proseWrap": "preserve",
+    "stylelintIntegration": true,
+    "stylelint.config": {
+        "indentation": 2
+    }
+}

build/build.js 3(+3 -0)

diff --git a/build/build.js b/build/build.js
new file mode 100644
index 0000000..a7dd1c9
--- /dev/null
+++ b/build/build.js
@@ -0,0 +1,3 @@
+import webpackBuild from 'dai-vue/src/build/webpack.build.js';
+import config from './config.js';
+webpackBuild(config);

build/config.js 22(+22 -0)

diff --git a/build/config.js b/build/config.js
new file mode 100644
index 0000000..ede94b8
--- /dev/null
+++ b/build/config.js
@@ -0,0 +1,22 @@
+import path from "path"
+const __dirname = path.resolve();
+export default {
+    port: 8090,
+    //打包目标目录
+    buildPath: './dist/',
+    //拷贝目录及文件
+    copy: [
+        {
+            //源目录/文件
+            from: './html',
+            //目标目录/文件
+            to: './dist/html',
+            ignore: ['.*']
+        }
+    ],
+    webpack: {
+        devServer: {
+            sockHost: '192.168.88.88'
+        }
+    }
+};

build/dev.js 3(+3 -0)

diff --git a/build/dev.js b/build/dev.js
new file mode 100644
index 0000000..d55bfbe
--- /dev/null
+++ b/build/dev.js
@@ -0,0 +1,3 @@
+import webpackDev from 'dai-vue/src/build/webpack.dev.js';
+import config from './config.js';
+webpackDev(config);

desktop.ini 6(+6 -0)

diff --git a/desktop.ini b/desktop.ini
new file mode 100644
index 0000000..6d58c28
--- /dev/null
+++ b/desktop.ini
@@ -0,0 +1,6 @@
+[.ShellClassInfo]
+InfoTip=DaiVue ����Ŀģ��
+[ViewState]
+Mode=
+Vid=
+FolderType=Generic
diff --git a/main/config/config.dev.js b/main/config/config.dev.js
new file mode 100644
index 0000000..0917544
--- /dev/null
+++ b/main/config/config.dev.js
@@ -0,0 +1,11 @@
+/**
+ * 开发环境配置
+ */
+const config = {
+    //接口服务配置
+    service: {
+        default: 'https://api.tuxiaoguai.com'
+    }
+};
+
+export default config;
diff --git a/main/config/config.js b/main/config/config.js
new file mode 100644
index 0000000..d3d37df
--- /dev/null
+++ b/main/config/config.js
@@ -0,0 +1,30 @@
+import extend from 'extend2';
+import configTest from './config.test.js';
+import configDev from './config.dev.js';
+/**默认的生产设置 开发及测试请单独设置 */
+var configDefault = {
+    //是否开发模式
+    isDev: false,
+    domain: 'http://localhost:8080',
+    //版本
+    version: '1.0.0',
+    //服务器配置
+    server: {},
+    //接口服务配置
+    service: {
+        default: 'http://192.168.88.88:8010'
+    }
+};
+//根据环境合并
+var config = {};
+if (process.env.NODE_ENV == 'development') {
+    config = extend(true, {}, configDefault, configDev);
+    config.isDev = true;
+} else if (process.env.NODE_ENV == 'test') {
+    config = extend(true, {}, configDefault, configTest);
+    config.isDev = true;
+} else {
+    config = extend(true, {}, configDefault);
+    config.isDev = false;
+}
+export default config;
diff --git a/main/config/config.test.js b/main/config/config.test.js
new file mode 100644
index 0000000..b04a19e
--- /dev/null
+++ b/main/config/config.test.js
@@ -0,0 +1,10 @@
+/**
+ * 开发环境配置
+ */
+const config = {
+    //是否开发模式
+    isDev: false,
+    service: {}
+};
+
+export default config;

main/favicon.ico 0(+0 -0)

diff --git a/main/favicon.ico b/main/favicon.ico
new file mode 100644
index 0000000..0eed320
Binary files /dev/null and b/main/favicon.ico differ

main/index.html 20(+20 -0)

diff --git a/main/index.html b/main/index.html
new file mode 100644
index 0000000..b6f1c3e
--- /dev/null
+++ b/main/index.html
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <meta
+            name="viewport"
+            content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"
+        />
+        <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
+        <!-- 禁止缓存 -->
+        <!-- <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
+        <meta http-equiv="Pragma" content="no-cache" />
+        <meta http-equiv="Expires" content="0" /> -->
+        <title><%= htmlWebpackPlugin.options.title %></title>
+    </head>
+    <body>
+        <div id="dai-app" class="dai-app d-box-v">
+            <router-view class="d-box-flex"></router-view>
+        </div>
+    </body>
+</html>

main/index.js 40(+40 -0)

diff --git a/main/index.js b/main/index.js
new file mode 100644
index 0000000..a7b7ce9
--- /dev/null
+++ b/main/index.js
@@ -0,0 +1,40 @@
+import { DaiVue, Vuex } from 'dai-vue';
+import * as modules from './modules.js';
+import config from './config/config.js';
+import interceptor from './interceptor.js';
+import store from './store.js';
+
+import './style.less';
+
+var vm = DaiVue(
+    {
+        store,
+        data() {
+            return {};
+        },
+        methods: {},
+        created: function () {},
+        watch: {},
+        components: {},
+        //计算属性
+        computed: {
+            ...Vuex.mapGetters(['vx_userInfo'])
+        }
+    },
+    {
+        //全局配置
+        config,
+        //引用的所有模块
+        modules: modules,
+
+        use: {
+            // Vant: { plugin: Vant }
+        },
+        //http 拦截器
+        interceptor
+    }
+);
+
+//挂载VUE
+vm.$mount('#dai-app');
+window.baseVue = vm;

main/interceptor.js 62(+62 -0)

diff --git a/main/interceptor.js b/main/interceptor.js
new file mode 100644
index 0000000..a14f0aa
--- /dev/null
+++ b/main/interceptor.js
@@ -0,0 +1,62 @@
+const interceptor = {
+    //请求拦截
+    request(options) {
+        options.headers.token = localStorage.getItem('token');
+    },
+    //响应拦截
+    response(response, options) {
+        let obj = { isErr: false, data: '' };
+        if (response.status == '200') {
+            var json = response.data;
+            if (json.isErr) {
+                //如果显示错误信息,弹出错误,否则继续执行
+                if (options.showMsg) {
+                    options.onError(this, '错误', json.errMsg);
+                    this.$vue.$Notice.error({
+                        title: '错误',
+                        desc: json.errMsg
+                    });
+                    console.error(json.errMsg);
+                    obj.isErr = true;
+                    obj.data = json;
+                    return obj;
+                } else {
+                    //继续执行,内部处理错误
+                    obj.isErr = false;
+                    obj.data = json;
+                    return obj;
+                }
+            } else {
+                //当现实返回消息时
+                if (options.showMsg) {
+                    if (json.msg) {
+                        // options.onMessage(this, '消息', json.msg);
+                        this.$vue.$Notice.success({
+                            title: json.msg,
+                            // desc: nodesc ? '' : 'Here is the notification description. Here is the notification description. '
+                        });
+                    }
+                    obj.isErr = false;
+                    obj.data = json.data;
+                    return obj;
+                }
+                //当不现实返回消息时
+                else {
+                    obj.isErr = false;
+                    obj.data = json;
+                    return obj;
+                }
+            }
+        } else {
+            console.error(response);
+            if (options.showMsg) {
+                options.onError(this, '网络错误', '请联系管理员解决');
+            }
+            obj.isErr = true;
+            obj.data = '网络错误';
+            return obj;
+        }
+        return obj;
+    }
+};
+export default interceptor;
\ No newline at end of file

main/modules.js 2(+2 -0)

diff --git a/main/modules.js b/main/modules.js
new file mode 100644
index 0000000..316032a
--- /dev/null
+++ b/main/modules.js
@@ -0,0 +1,2 @@
+import main from '../src/index.js';
+export { main };

main/store.js 20(+20 -0)

diff --git a/main/store.js b/main/store.js
new file mode 100644
index 0000000..033e7f2
--- /dev/null
+++ b/main/store.js
@@ -0,0 +1,20 @@
+import { Vue, Vuex } from 'dai-vue';
+Vue.use(Vuex);
+//创建VueX对象
+const store = new Vuex.Store({
+    state: {
+        //用户信息
+        vx_userInfo: {}
+    },
+    getters: {
+        vx_userInfo: (state) => state.vx_userInfo
+    },
+    mutations: {
+        vx_userInfo(state, userInfo) {
+            // 变更状态
+            state.userInfo = userInfo;
+        }
+    }
+});
+
+export default store;

main/style.less 2(+2 -0)

diff --git a/main/style.less b/main/style.less
new file mode 100644
index 0000000..332f5b2
--- /dev/null
+++ b/main/style.less
@@ -0,0 +1,2 @@
+//全局样式配置
+// @import '~dai-style/src/dai.less';

package.json 16(+16 -0)

diff --git a/package.json b/package.json
new file mode 100644
index 0000000..560cf05
--- /dev/null
+++ b/package.json
@@ -0,0 +1,16 @@
+{
+    "name": "dai-vue-temp-m",
+    "type":"module",
+    "version": "1.0.0",
+    "description": "dai-vue",
+    "main": "src/index.js",
+    "scripts": {
+        "dev": "node ./build/dev.js",
+        "build": "node ./build/build.js"
+    },
+    "author": "",
+    "license": "ISC",
+    "dependencies": {
+        "dai-vue": "^1.0.15"
+    }
+}

src/api.js 19(+19 -0)

diff --git a/src/api.js b/src/api.js
new file mode 100644
index 0000000..5d3a2da
--- /dev/null
+++ b/src/api.js
@@ -0,0 +1,19 @@
+var test = {
+    $config: {
+        /**读取配置文件中 service 字段,默认 default*/
+        service: 'default',
+        /**基础URL */
+        baseURL: '/test/',
+        /**请求方式,不配置为 payload*/
+        requestType: 'formData'
+    },
+    /**
+     * 接口方法  在 vue 页面中可以使用方法  await this.$api.test.test({});
+     * @param {Object} data
+     * @returns
+     */
+    async test(data) {
+        return await this.$get('test', data);
+    }
+};
+export { test };

src/index.js 8(+8 -0)

diff --git a/src/index.js b/src/index.js
new file mode 100644
index 0000000..a49b8ad
--- /dev/null
+++ b/src/index.js
@@ -0,0 +1,8 @@
+import * as api from './api.js';
+import routes from './routes.js';
+const models = {};
+export default {
+    api,
+    routes,
+    models
+};

src/page/home.vue 28(+28 -0)

diff --git a/src/page/home.vue b/src/page/home.vue
new file mode 100644
index 0000000..b625459
--- /dev/null
+++ b/src/page/home.vue
@@ -0,0 +1,28 @@
+<style lang="less" scoped>
+</style>
+<template>
+    <div style="text-align: center;">
+        <div><img style="width:200px;" src="../static/image/vue-logo.png" /></div>
+        <div style="font-size:28px;">DaiVUE</div>
+        <div>简易VUE网站快速成型框架</div>
+    </div>
+</template>
+<script type="text/javascript">
+import { Vuex } from 'dai-vue';
+export default {
+    props: {},
+    data() {
+        return {};
+    },
+    components: {},
+    methods: {},
+    watch: {},
+    created() {},
+    mounted() {},
+    //计算属性
+    computed: {
+        ...Vuex.mapGetters(['vx_userInfo'])
+    },
+    destroyed() {}
+};
+</script>
\ No newline at end of file

src/routes.js 2(+2 -0)

diff --git a/src/routes.js b/src/routes.js
new file mode 100644
index 0000000..a37dd1a
--- /dev/null
+++ b/src/routes.js
@@ -0,0 +1,2 @@
+const routes = [{ path: '/', component: () => import('./page/home.vue'), meta: { pageName: '首页' } }];
+export default routes;
diff --git a/src/static/image/vue-logo.png b/src/static/image/vue-logo.png
new file mode 100644
index 0000000..102329c
Binary files /dev/null and b/src/static/image/vue-logo.png differ
diff --git a/src/static/style/style.less b/src/static/style/style.less
new file mode 100644
index 0000000..b5736f8
--- /dev/null
+++ b/src/static/style/style.less
@@ -0,0 +1,4 @@
+//模块内样式
+.module-test{
+    
+}
\ No newline at end of file

types/type.d.ts 154(+154 -0)

diff --git a/types/type.d.ts b/types/type.d.ts
new file mode 100644
index 0000000..4c078d4
--- /dev/null
+++ b/types/type.d.ts
@@ -0,0 +1,154 @@
+declare module uni {
+    // /**
+    //  * 保留当前页面,跳转到应用内的某个页面,使用uni.navigateBack可以返回到原页面。
+    //  * @param object
+    //  */
+    function navigateTo(object: object);
+    /**
+     * 关闭当前页面,跳转到应用内的某个页面。
+     * @param object
+     */
+    function redirectTo(object: object);
+    /**
+     * 关闭所有页面,打开到应用内的某个页面。
+     * @param object
+     */
+    function reLaunch(object: object);
+    /**
+     * 跳转到 tabBar 页面,并关闭其他所有非 tabBar 页面
+     * @param object
+     */
+    function switchTab(object: object);
+    /**
+     * 关闭当前页面,返回上一页面或多级页面。
+     * @param object
+     */
+    function navigateBack(object: object): null;
+    /**
+     * 预加载页面,是一种性能优化技术。被预载的页面,在打开时速度更快。
+     * @param object {Object}
+     */
+    function preloadPage(object: object);
+    /**
+     * 将数据存储在本地缓存中指定的 key 中,会覆盖掉原来该 key 对应的内容,这是一个异步接口。
+     * @param object
+     */
+    function setStorage(object: object);
+    /**
+     * 将 data 存储在本地缓存中指定的 key 中,会覆盖掉原来该 key 对应的内容,这是一个同步接口。
+     * @param key
+     * @param value
+     */
+    function setStorageSync(key: string, value: string);
+    /**
+     * 从本地缓存中异步获取指定 key 对应的内容。
+     * @param object
+     */
+    function getStorage(object: object);
+    /**
+     * 从本地缓存中同步获取指定 key 对应的内容。
+     * @param key
+     */
+    function getStorageSync(key: string): string;
+    /**
+     * 异步获取当前 storage 的相关信息。
+     * @param object
+     */
+    function getStorageInfo(object: object);
+    /**
+     * 同步获取当前 storage 的相关信息。
+     * @param object
+     */
+    function getStorageInfoSync(object: string): object;
+    /**
+     * 从本地缓存中异步移除指定 key。
+     * @param object
+     */
+    function removeStorage(object: object);
+    /**
+     * 从本地缓存中同步移除指定 key。
+     * @param object
+     */
+    function removeStorageSync(object: object);
+    /**
+     * 同步清理本地数据缓存。
+     * @param object
+     */
+    function clearStorage(object: object);
+    /**
+     * 同步清理本地数据缓存。
+     * @param object
+     */
+    function clearStorageSync(object: object);
+    /**
+     * 获取当前的地理位置、速度。 在微信小程序中,当用户离开应用后,此接口无法调用,除非申请后台持续定位权限;当用户点击“显示在聊天顶部”时,此接口可继续调用。
+     * @param object
+     */
+    function getLocation(object: object);
+    /**
+     * 打开地图选择位置。
+     * @param object
+     */
+    function chooseLocation(object: object);
+    /**
+     * 使用应用内置地图查看位置。
+     * @param object
+     */
+    function openLocation(object: object);
+    /**
+     * 显示消息提示框。
+     * @param object
+     */
+    function showToast(object: object);
+    /**
+     * 隐藏消息框
+     * @param object
+     */
+    function hideToast(object: object);
+    /**
+     * 显示 loading 提示框, 需主动调用 uni.hideLoading 才能关闭提示框。
+     * @param object
+     */
+    function showLoading(object: object);
+    /**
+     * 隐藏 loading 提示框。
+     * @param object
+     */
+    function hideLoading(object: object);
+    /**
+     * 显示模态弹窗,可以只有一个确定按钮,也可以同时有确定和取消按钮。类似于一个API整合了 html 中:alert、confirm。
+     * @param object
+     */
+    function showModal(object: object);
+    /**
+     * 从底部向上弹出操作菜单
+     * @param object
+     */
+    function showActionSheet(object: object);
+    /**
+     * 动态设置当前页面的标题。
+     * @param object
+     */
+    function setNavigationBarTitle(object: object);
+    /**
+     * 设置页面导航条颜色。如果需要进入页面就设置颜色,请延迟执行,防止被框架内设置颜色逻辑覆盖
+     * @param object
+     */
+    function setNavigationBarColor(object: object);
+    /**
+     * 在当前页面显示导航条加载动画。
+     * @param object
+     */
+    function showNavigationBarLoading(object: object);
+    /**
+     * 在当前页面隐藏导航条加载动画。
+     * @param object
+     */
+    function hideNavigationBarLoading(object: object);
+    /**
+     * 隐藏返回首页按钮。
+     * @param object
+     */
+    function hideHomeButton(object: object);
+    function xxxxxxxxx(object: object);
+}