diff --git a/yudao-ui-app/.gitignore b/yudao-ui-app/.gitignore new file mode 100644 index 000000000..5823d4712 --- /dev/null +++ b/yudao-ui-app/.gitignore @@ -0,0 +1,7 @@ +/unpackage/dist/* +/unpackage/cache/* +/unpackage/release/* +/node_modules/* +/.idea/* +/.hbuilderx/ +/.vscode/ diff --git a/yudao-ui-app/App.vue b/yudao-ui-app/App.vue index cb4ef8126..35ba97f7f 100644 --- a/yudao-ui-app/App.vue +++ b/yudao-ui-app/App.vue @@ -15,11 +15,8 @@ diff --git a/yudao-ui-app/app.scss b/yudao-ui-app/app.scss new file mode 100644 index 000000000..954306e77 --- /dev/null +++ b/yudao-ui-app/app.scss @@ -0,0 +1,52 @@ +/* 页面公共scss */ +.container { + padding-top: var(--status-bar-height);//uni-app提供了状态栏高度的css变量--status-bar-height + background-color: $uni-bg-color; + box-sizing: border-box; + height: 100%; +} + +/* 布局间距 */ +.m-0-r { + margin: 0rpx; +} + +.mtb-0-r { + margin-top: 0rpx; + margin-bottom: 0rpx; +} + +.no-mlt { + margin-left: 0rpx; + margin-right: 0rpx; +} + +.mtb-30-r { + margin-top: 30rpx; + margin-bottom: 30rpx; +} + +.mlr-30-r { + margin-left: 30rpx; + margin-right: 30rpx; +} + +.mt-20-r {margin-top: 20rpx;} +.mt-30-r {margin-top: 30rpx;} +.mt-40-r {margin-top: 40rpx;} +.mt-50-r {margin-top: 50rpx;} + +.mb-20-r {margin-bottom: 20rpx;} +.mb-30-r {margin-bottom: 30rpx;} +.mb-40-r {margin-bottom: 40rpx;} +.mb-50-r {margin-bottom: 50rpx;} + +.ml-20-r {margin-left: 20rpx;} +.ml-30-r {margin-left: 30rpx;} +.ml-40-r {margin-left: 40rpx;} +.ml-50-r {margin-left: 50rpx;} + +.mr-20-r {margin-right: 20rpx;} +.mr-30-r {margin-right: 30rpx;} +.mr-40-r {margin-right: 40rpx;} +.mr-50-r {margin-right: 50rpx;} diff --git a/yudao-ui-app/common/api.js b/yudao-ui-app/common/api.js new file mode 100644 index 000000000..9c2e41e5e --- /dev/null +++ b/yudao-ui-app/common/api.js @@ -0,0 +1,7 @@ +const { http } = uni.$u + +/* index */ +// 获取滚动图数据 +export const getBannerData = params => http.get('/api/index', params) +// 获取滚动通知数据 +export const getNoticeData = params => http.get('/api/notice', params) diff --git a/yudao-ui-app/common/config.js b/yudao-ui-app/common/config.js new file mode 100644 index 000000000..ec3682f18 --- /dev/null +++ b/yudao-ui-app/common/config.js @@ -0,0 +1,3 @@ +module.exports = { + baseUrl: 'http://192.168.3.199:8086' +} diff --git a/yudao-ui-app/common/mixin.js b/yudao-ui-app/common/mixin.js new file mode 100644 index 000000000..b6a4eeee3 --- /dev/null +++ b/yudao-ui-app/common/mixin.js @@ -0,0 +1,7 @@ +export default { + data() { + return { + + } + } +} diff --git a/yudao-ui-app/common/props.js b/yudao-ui-app/common/props.js new file mode 100644 index 000000000..30f4924f4 --- /dev/null +++ b/yudao-ui-app/common/props.js @@ -0,0 +1,2 @@ +uni.$u.props.gap.bgColor = '#ffffff' +uni.$u.props.gap.height = '10' diff --git a/yudao-ui-app/index.html b/yudao-ui-app/index.html index c3ff205f6..03e5fc6e1 100644 --- a/yudao-ui-app/index.html +++ b/yudao-ui-app/index.html @@ -3,7 +3,7 @@ + + diff --git a/yudao-ui-app/pages/index/index.vue b/yudao-ui-app/pages/index/index.vue new file mode 100644 index 000000000..240603e00 --- /dev/null +++ b/yudao-ui-app/pages/index/index.vue @@ -0,0 +1,325 @@ + + + + + diff --git a/yudao-ui-app/pages/login/login.vue b/yudao-ui-app/pages/login/login.vue new file mode 100644 index 000000000..bbee7a876 --- /dev/null +++ b/yudao-ui-app/pages/login/login.vue @@ -0,0 +1,149 @@ + + + + + diff --git a/yudao-ui-app/pages/index/index.nvue b/yudao-ui-app/pages/profile/profile.vue similarity index 94% rename from yudao-ui-app/pages/index/index.nvue rename to yudao-ui-app/pages/profile/profile.vue index d14e16907..f19c84d9e 100644 --- a/yudao-ui-app/pages/index/index.nvue +++ b/yudao-ui-app/pages/profile/profile.vue @@ -1,6 +1,6 @@ @@ -21,5 +21,4 @@ diff --git a/yudao-ui-app/pages/register/register.vue b/yudao-ui-app/pages/register/register.vue new file mode 100644 index 000000000..b82e4f8fc --- /dev/null +++ b/yudao-ui-app/pages/register/register.vue @@ -0,0 +1,144 @@ + + + + + diff --git a/yudao-ui-app/pages/user/user.nvue b/yudao-ui-app/pages/user/user.nvue deleted file mode 100644 index d14e16907..000000000 --- a/yudao-ui-app/pages/user/user.nvue +++ /dev/null @@ -1,25 +0,0 @@ - - - - - diff --git a/yudao-ui-app/pages/user/user.vue b/yudao-ui-app/pages/user/user.vue new file mode 100644 index 000000000..6fc69669f --- /dev/null +++ b/yudao-ui-app/pages/user/user.vue @@ -0,0 +1,145 @@ + + + + + diff --git a/yudao-ui-app/store/index.js b/yudao-ui-app/store/index.js new file mode 100644 index 000000000..f2d6d32d8 --- /dev/null +++ b/yudao-ui-app/store/index.js @@ -0,0 +1,26 @@ +import Vue from 'vue' +import Vuex from 'vuex' + +Vue.use(Vuex) // vue的插件机制 + +// Vuex.Store 构造器选项 +const store = new Vuex.Store({ + // 为了不和页面或组件的data中的造成混淆,state中的变量前面建议加上$符号 + state: { + // 用户信息 + $userInfo: { + id: '' + } + }, + mutations: { + + }, + actions: { + + }, + getters:{ + + } +}) + +export default store diff --git a/yudao-ui-app/uni_modules/uview-ui/components/u--text-price/u--text-price.vue b/yudao-ui-app/uni_modules/uview-ui/components/u--text-price/u--text-price.vue new file mode 100644 index 000000000..eb861ac72 --- /dev/null +++ b/yudao-ui-app/uni_modules/uview-ui/components/u--text-price/u--text-price.vue @@ -0,0 +1,59 @@ + + + + \ No newline at end of file diff --git a/yudao-ui-app/util/request/index.js b/yudao-ui-app/util/request/index.js new file mode 100644 index 000000000..6658821b6 --- /dev/null +++ b/yudao-ui-app/util/request/index.js @@ -0,0 +1,13 @@ +// 引入配置 +import config from '@/common/config' +// 初始化请求配置 +uni.$u.http.setConfig((defaultConfig) => { + /* defaultConfig 为默认全局配置 */ + defaultConfig.baseURL = config.baseUrl /* 根域名 */ + return defaultConfig +}) + +module.exports = (vm) => { + require('./requestInterceptors')(vm) + require('./responseInterceptors')(vm) +} diff --git a/yudao-ui-app/util/request/requestInterceptors.js b/yudao-ui-app/util/request/requestInterceptors.js new file mode 100644 index 000000000..e954479a4 --- /dev/null +++ b/yudao-ui-app/util/request/requestInterceptors.js @@ -0,0 +1,14 @@ +/** + * 请求拦截 + * @param {Object} http + */ +module.exports = (vm) => { + uni.$u.http.interceptors.request.use((config) => { // 可使用async await 做异步操作 + // 初始化请求拦截器时,会执行此方法,此时data为undefined,赋予默认{} + config.data = config.data || {} + // 可以在此通过vm引用vuex中的变量,具体值在vm.$store.state中 + // console.log(vm.$store.state); + return config + }, (config) => // 可使用async await 做异步操作 + Promise.reject(config)) +} diff --git a/yudao-ui-app/util/request/responseInterceptors.js b/yudao-ui-app/util/request/responseInterceptors.js new file mode 100644 index 000000000..0e437d78c --- /dev/null +++ b/yudao-ui-app/util/request/responseInterceptors.js @@ -0,0 +1,17 @@ +/** + * 响应拦截 + * @param {Object} http + */ +module.exports = (vm) => { + uni.$u.http.interceptors.response.use((res) => { + /* 对响应成功做点什么 可使用async await 做异步操作*/ + const data = res.data + /* + 可以根据业务情况做相应的处理 + */ + return res + }, (err) => { + /* 对响应错误做点什么 (statusCode !== 200)*/ + return Promise.reject(err) + }) +} \ No newline at end of file diff --git a/yudao-ui-app/vue.config.js b/yudao-ui-app/vue.config.js new file mode 100644 index 000000000..64a3fe5c1 --- /dev/null +++ b/yudao-ui-app/vue.config.js @@ -0,0 +1,10 @@ +module.exports = { + // 配置路径别名 + configureWebpack: { + devServer: { + // 调试时允许内网穿透,让外网的人访问到本地调试的H5页面 + disableHostCheck: true + } + } + // productionSourceMap: false, +}