commit 826ef990d342906e998e5a473b60722d15aed25f Author: sundongyu <2811054731@qq.com> Date: Sat Jun 15 21:13:11 2024 +0800 🎉 init: 初始化仓库 diff --git a/.env.development b/.env.development new file mode 100644 index 0000000..4360ec1 --- /dev/null +++ b/.env.development @@ -0,0 +1,2 @@ +VITE_BASE_URL = 'https://testpay.dykj.co' +VITE_TOKEN = '' \ No newline at end of file diff --git a/.env.porduction b/.env.porduction new file mode 100644 index 0000000..4360ec1 --- /dev/null +++ b/.env.porduction @@ -0,0 +1,2 @@ +VITE_BASE_URL = 'https://testpay.dykj.co' +VITE_TOKEN = '' \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f6a9094 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +node_modules +unpackage +uni_modules \ No newline at end of file diff --git a/.hbuilderx/launch.json b/.hbuilderx/launch.json new file mode 100644 index 0000000..81f13f4 --- /dev/null +++ b/.hbuilderx/launch.json @@ -0,0 +1,16 @@ +{ // launch.json 配置了启动调试时相关设置,configurations下节点名称可为 app-plus/h5/mp-weixin/mp-baidu/mp-alipay/mp-qq/mp-toutiao/mp-360/ + // launchtype项可配置值为local或remote, local代表前端连本地云函数,remote代表前端连云端云函数 + "version": "0.0", + "configurations": [{ + "default" : + { + "launchtype" : "local" + }, + "mp-weixin" : + { + "launchtype" : "local" + }, + "type" : "uniCloud" + } + ] +} diff --git a/App.vue b/App.vue new file mode 100644 index 0000000..57da359 --- /dev/null +++ b/App.vue @@ -0,0 +1,21 @@ + + + diff --git a/api/commodity/index.js b/api/commodity/index.js new file mode 100644 index 0000000..a4d49d5 --- /dev/null +++ b/api/commodity/index.js @@ -0,0 +1,17 @@ +import { http } from '@/utils/request.js'; +// 查询所有商品参数 +export function APIGetcommoditylist() { + return http.get('/api/wGoods/getGoods'); +} +//查询分类商品 +export function APIGetclassifylist(wCateid) { + return http.get(`/api/wGoods/getGoodsByWCateid?wCateid=${wCateid}`); +} +//查询所有分类 +export function APIAllcategorieslist() { + return http.get('/api/wcate/getCate'); +} +// 查询商品详情 +export function APIparticulars(id) { + return http.get(`/api/wGoods/getGoodsById?id=${id}`); +} diff --git a/api/order/index.js b/api/order/index.js new file mode 100644 index 0000000..098eed0 --- /dev/null +++ b/api/order/index.js @@ -0,0 +1,9 @@ +import { http } from '@/utils/request.js'; +// 生成订单 +export function APIPostCreateOrder(data) { + return http.post('/api/oder/addOder', data); +} +// 支付订单 +export function APIGetpayment(orderNo) { + return http.get(`/api/wx/login/wxpay?orderNo=${orderNo}`); +} diff --git a/api/site/index.js b/api/site/index.js new file mode 100644 index 0000000..3ec714a --- /dev/null +++ b/api/site/index.js @@ -0,0 +1,17 @@ +import { http } from '@/utils/request.js'; +// 修改地址 +export function APIPostModificationAddress(data) { + return http.post('/api/waddress/updateWaddress', data); +} +// 添加地址 +export function APIPostAddAddress(data) { + return http.post('/api/waddress/addWaddress', data); +} +// 查询地址 +export function APIGetinquireAddress() { + return http.get('/api/waddress/getWaddressByuid'); +} +// 删除地址 +export function APIGetDeleteAddress(id) { + return http.get(`/api/waddress/deleteWaddress?id=${id}`); +} diff --git a/api/user/index.js b/api/user/index.js new file mode 100644 index 0000000..587dafa --- /dev/null +++ b/api/user/index.js @@ -0,0 +1,5 @@ +import { http } from '@/utils/request.js'; +// 登录 +export function APIuserLogin(code) { + return http.get(`/api/wx/login/dologin?code=${code}`); +} diff --git a/components/shoppingIcon.vue b/components/shoppingIcon.vue new file mode 100644 index 0000000..af6f95b --- /dev/null +++ b/components/shoppingIcon.vue @@ -0,0 +1,44 @@ + + + + + diff --git a/index.html b/index.html new file mode 100644 index 0000000..c3ff205 --- /dev/null +++ b/index.html @@ -0,0 +1,20 @@ + + + + + + + + + + +
+ + + diff --git a/main.js b/main.js new file mode 100644 index 0000000..c1caf36 --- /dev/null +++ b/main.js @@ -0,0 +1,22 @@ +import App from './App' + +// #ifndef VUE3 +import Vue from 'vue' +import './uni.promisify.adaptor' +Vue.config.productionTip = false +App.mpType = 'app' +const app = new Vue({ + ...App +}) +app.$mount() +// #endif + +// #ifdef VUE3 +import { createSSRApp } from 'vue' +export function createApp() { + const app = createSSRApp(App) + return { + app + } +} +// #endif \ No newline at end of file diff --git a/manifest.json b/manifest.json new file mode 100644 index 0000000..a3ebc75 --- /dev/null +++ b/manifest.json @@ -0,0 +1,72 @@ +{ + "name": "dykj-water-supply station", + "appid": "__UNI__E1D98F3", + "description": "", + "versionName": "1.0.0", + "versionCode": "100", + "transformPx": false, + /* 5+App特有相关 */ + "app-plus": { + "usingComponents": true, + "nvueStyleCompiler": "uni-app", + "compilerVersion": 3, + "splashscreen": { + "alwaysShowBeforeRender": true, + "waiting": true, + "autoclose": true, + "delay": 0 + }, + /* 模块配置 */ + "modules": {}, + /* 应用发布信息 */ + "distribute": { + /* android打包配置 */ + "android": { + "permissions": [ + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ] + }, + /* ios打包配置 */ + "ios": {}, + /* SDK配置 */ + "sdkConfigs": {} + } + }, + /* 快应用特有相关 */ + "quickapp": {}, + /* 小程序特有相关 */ + "mp-weixin": { + "appid": "wx1f8fbec46293a728", + "setting": { + "urlCheck": false + }, + "usingComponents": true + }, + "mp-alipay": { + "usingComponents": true + }, + "mp-baidu": { + "usingComponents": true + }, + "mp-toutiao": { + "usingComponents": true + }, + "uniStatistics": { + "enable": false + }, + "vueVersion": "3" +} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..29fdc72 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,88 @@ +{ + "name": "dykj-water-supply station", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "dependencies": { + "luch-request": "^3.1.1", + "pinia": "^2.1.7" + } + }, + "node_modules/@dcloudio/types": { + "version": "2.6.12", + "resolved": "https://registry.npmjs.org/@dcloudio/types/-/types-2.6.12.tgz", + "integrity": "sha512-mrCMwcINy1IFjU9VUqLeWBkj404yWs5paLDttBcA+eqUjanuUQbBcTVPqlrGgkyzLXDcV2oDDZRSNxNpXi4kMQ==" + }, + "node_modules/@vue/devtools-api": { + "version": "6.6.3", + "resolved": "https://registry.npmjs.org/@vue/devtools-api/-/devtools-api-6.6.3.tgz", + "integrity": "sha512-0MiMsFma/HqA6g3KLKn+AGpL1kgKhFWszC9U29NfpWK5LE7bjeXxySWJrOJ77hBz+TBrBQ7o4QJqbPbqbs8rJw==" + }, + "node_modules/luch-request": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/luch-request/-/luch-request-3.1.1.tgz", + "integrity": "sha512-p7+mlcEtgRcd0OfXC4XZbyiwSr1XgCeqNT7LlVUjnk7InYl/8d5Rk7BUqAYNA2WRafI1wRIUQWRWZRpeUwWR0w==", + "dependencies": { + "@dcloudio/types": "^2.0.16" + } + }, + "node_modules/pinia": { + "version": "2.1.7", + "resolved": "https://registry.npmjs.org/pinia/-/pinia-2.1.7.tgz", + "integrity": "sha512-+C2AHFtcFqjPih0zpYuvof37SFxMQ7OEG2zV9jRI12i9BOy3YQVAHwdKtyyc8pDcDyIc33WCIsZaCFWU7WWxGQ==", + "dependencies": { + "@vue/devtools-api": "^6.5.0", + "vue-demi": ">=0.14.5" + }, + "funding": { + "url": "https://github.com/sponsors/posva" + }, + "peerDependencies": { + "@vue/composition-api": "^1.4.0", + "typescript": ">=4.4.4", + "vue": "^2.6.14 || ^3.3.0" + }, + "peerDependenciesMeta": { + "@vue/composition-api": { + "optional": true + }, + "typescript": { + "optional": true + } + } + }, + "node_modules/vue": { + "version": "2.6.14", + "resolved": "https://registry.npmjs.org/vue/-/vue-2.6.14.tgz", + "integrity": "sha512-x2284lgYvjOMj3Za7kqzRcUSxBboHqtgRE2zlos1qWaOye5yUmHn42LB1250NJBLRwEcdrB0JRwyPTEPhfQjiQ==", + "deprecated": "Vue 2 has reached EOL and is no longer actively maintained. See https://v2.vuejs.org/eol/ for more details.", + "peer": true + }, + "node_modules/vue-demi": { + "version": "0.14.8", + "resolved": "https://registry.npmjs.org/vue-demi/-/vue-demi-0.14.8.tgz", + "integrity": "sha512-Uuqnk9YE9SsWeReYqK2alDI5YzciATE0r2SkA6iMAtuXvNTMNACJLJEXNXaEy94ECuBe4Sk6RzRU80kjdbIo1Q==", + "hasInstallScript": true, + "bin": { + "vue-demi-fix": "bin/vue-demi-fix.js", + "vue-demi-switch": "bin/vue-demi-switch.js" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/antfu" + }, + "peerDependencies": { + "@vue/composition-api": "^1.0.0-rc.1", + "vue": "^3.0.0-0 || ^2.6.0" + }, + "peerDependenciesMeta": { + "@vue/composition-api": { + "optional": true + } + } + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..87be410 --- /dev/null +++ b/package.json @@ -0,0 +1,6 @@ +{ + "dependencies": { + "luch-request": "^3.1.1", + "pinia": "^2.1.7" + } +} diff --git a/pages.json b/pages.json new file mode 100644 index 0000000..23d5169 --- /dev/null +++ b/pages.json @@ -0,0 +1,135 @@ +{ + "pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages + { + "path": "pages/index/index", + "style": { + "navigationBarTitleText": "首页" + } + }, + { + "path": "pages/index/components/coupon", + "style": { + "navigationBarTitleText": "优惠券" + } + }, + + { + "path": "pages/index/components/shoppingCart", + "style": { + "navigationBarTitleText": "购物车" + } + }, + { + "path": "pages/index/components/switchStores", + "style": { + "navigationBarTitleText": "切换门店" + } + }, + { + "path": "pages/order-water/index", + "style": { + "navigationBarTitleText": "订水" + } + }, + { + "path": "pages/water-coupon/index", + "style": { + "navigationBarTitleText": "水票" + } + }, + { + "path": "pages/water-coupon/components/particulars", + "style": { + "navigationBarTitleText": "水票详情" + } + }, + { + "path": "pages/shopp/index", + "style": { + "navigationBarTitleText": "商城" + } + }, + { + "path": "pages/shopp/components/commodityDetails", + "style": { + "navigationBarTitleText": "商品详情" + } + }, + { + "path": "pages/shopp/components/orderForm", + "style": { + "navigationBarTitleText": "提交订单" + } + }, + { + "path": "pages/my/index", + "style": { + "navigationBarTitleText": "我的" + } + }, + { + "path": "pages/my/components/login", + "style": { + "navigationBarTitleText": "登录" + } + }, + { + "path": "pages/my/components/myOrder", + "style": { + "navigationBarTitleText": "我的订单" + } + }, + { + "path": "pages/my/components/myAddress", + "style": { + "navigationBarTitleText": "收货地址" + } + }, + { + "path": "pages/my/components/addShippingAddress", + "style": { + "navigationBarTitleText": "新增地址" + } + } + ], + "globalStyle": { + "navigationBarTextStyle": "black", + "navigationBarTitleText": "水站", + "navigationBarBackgroundColor": "#F8F8F8", + "backgroundColor": "#F8F8F8" + }, + "uniIdRouter": {}, + "tabBar": { + "list": [{ + "pagePath": "pages/index/index", + "text": "首页" + // "iconPath": "https://i.postimg.cc/SQ2gyt5d/image.png", + // "selectedIconPath": "https://i.postimg.cc/vZLPJgjd/image.png" + }, + { + "pagePath": "pages/water-coupon/index", + "text": "水票" + // "iconPath": "https://i.postimg.cc/N0sNBGq2/image.png", + // "selectedIconPath": "https://i.postimg.cc/qRgj6m7k/image.png" + }, + { + "pagePath": "pages/order-water/index", + "text": "订水" + // "iconPath": "https://i.postimg.cc/MT4t7yc1/image.png", + // "selectedIconPath": "https://i.postimg.cc/tJxk2YPw/image.png" + }, + { + "pagePath": "pages/shopp/index", + "text": "商城" + // "iconPath": "https://i.postimg.cc/MT4t7yc1/image.png", + // "selectedIconPath": "https://i.postimg.cc/tJxk2YPw/image.png" + }, + { + "pagePath": "pages/my/index", + "text": "我的" + // "iconPath": "https://i.postimg.cc/nhtRSY3k/image.png", + // "selectedIconPath": "https://i.postimg.cc/nL33z8pR/image.png" + } + ] + } +} \ No newline at end of file diff --git a/pages/index/components/coupon.vue b/pages/index/components/coupon.vue new file mode 100644 index 0000000..57e684e --- /dev/null +++ b/pages/index/components/coupon.vue @@ -0,0 +1,74 @@ + + + + + diff --git a/pages/index/components/shoppingCart.vue b/pages/index/components/shoppingCart.vue new file mode 100644 index 0000000..d24bcab --- /dev/null +++ b/pages/index/components/shoppingCart.vue @@ -0,0 +1,252 @@ + + + + + diff --git a/pages/index/components/switchStores.vue b/pages/index/components/switchStores.vue new file mode 100644 index 0000000..9fbcb9d --- /dev/null +++ b/pages/index/components/switchStores.vue @@ -0,0 +1,76 @@ + + + + + diff --git a/pages/index/index.vue b/pages/index/index.vue new file mode 100644 index 0000000..9d33bda --- /dev/null +++ b/pages/index/index.vue @@ -0,0 +1,498 @@ + + + + + diff --git a/pages/my/components/addShippingAddress.vue b/pages/my/components/addShippingAddress.vue new file mode 100644 index 0000000..ca76552 --- /dev/null +++ b/pages/my/components/addShippingAddress.vue @@ -0,0 +1,166 @@ + + + + + diff --git a/pages/my/components/login.vue b/pages/my/components/login.vue new file mode 100644 index 0000000..fe68a1a --- /dev/null +++ b/pages/my/components/login.vue @@ -0,0 +1,137 @@ + + + + + diff --git a/pages/my/components/myAddress.vue b/pages/my/components/myAddress.vue new file mode 100644 index 0000000..2e79788 --- /dev/null +++ b/pages/my/components/myAddress.vue @@ -0,0 +1,130 @@ + + + + + diff --git a/pages/my/components/myOrder.vue b/pages/my/components/myOrder.vue new file mode 100644 index 0000000..4981687 --- /dev/null +++ b/pages/my/components/myOrder.vue @@ -0,0 +1,62 @@ + + + + + diff --git a/pages/my/index.vue b/pages/my/index.vue new file mode 100644 index 0000000..ec661d3 --- /dev/null +++ b/pages/my/index.vue @@ -0,0 +1,214 @@ + + + + + diff --git a/pages/order-water/index.vue b/pages/order-water/index.vue new file mode 100644 index 0000000..e995049 --- /dev/null +++ b/pages/order-water/index.vue @@ -0,0 +1,132 @@ + + + + + diff --git a/pages/shopp/components/commodityDetails.vue b/pages/shopp/components/commodityDetails.vue new file mode 100644 index 0000000..10287c9 --- /dev/null +++ b/pages/shopp/components/commodityDetails.vue @@ -0,0 +1,214 @@ + + + + + diff --git a/pages/shopp/components/orderForm.vue b/pages/shopp/components/orderForm.vue new file mode 100644 index 0000000..34a1736 --- /dev/null +++ b/pages/shopp/components/orderForm.vue @@ -0,0 +1,215 @@ + + + + + diff --git a/pages/shopp/index.vue b/pages/shopp/index.vue new file mode 100644 index 0000000..b4b6971 --- /dev/null +++ b/pages/shopp/index.vue @@ -0,0 +1,147 @@ + + + + + diff --git a/pages/water-coupon/components/particulars.vue b/pages/water-coupon/components/particulars.vue new file mode 100644 index 0000000..ae6ff3e --- /dev/null +++ b/pages/water-coupon/components/particulars.vue @@ -0,0 +1,149 @@ + + + + + diff --git a/pages/water-coupon/index.vue b/pages/water-coupon/index.vue new file mode 100644 index 0000000..b3cf483 --- /dev/null +++ b/pages/water-coupon/index.vue @@ -0,0 +1,84 @@ + + + + + diff --git a/static/icon/iconfont.ttf b/static/icon/iconfont.ttf new file mode 100644 index 0000000..2ad0d74 Binary files /dev/null and b/static/icon/iconfont.ttf differ diff --git a/static/logo.png b/static/logo.png new file mode 100644 index 0000000..b5771e2 Binary files /dev/null and b/static/logo.png differ diff --git a/static/优惠劵.jpeg b/static/优惠劵.jpeg new file mode 100644 index 0000000..c2a58c8 Binary files /dev/null and b/static/优惠劵.jpeg differ diff --git a/store/index.js b/store/index.js new file mode 100644 index 0000000..ef4eb12 --- /dev/null +++ b/store/index.js @@ -0,0 +1,14 @@ +import { defineStore } from 'pinia'; + +export const useUserStore = defineStore('user', { + state: () => { + return { + token: '' + }; + }, + actions: { + userLogin(token) { + this.token = token; + } + } +}); diff --git a/uni.promisify.adaptor.js b/uni.promisify.adaptor.js new file mode 100644 index 0000000..47fbce1 --- /dev/null +++ b/uni.promisify.adaptor.js @@ -0,0 +1,10 @@ +uni.addInterceptor({ + returnValue (res) { + if (!(!!res && (typeof res === "object" || typeof res === "function") && typeof res.then === "function")) { + return res; + } + return new Promise((resolve, reject) => { + res.then((res) => res[0] ? reject(res[0]) : resolve(res[1])); + }); + }, +}); \ No newline at end of file diff --git a/uni.scss b/uni.scss new file mode 100644 index 0000000..6c5bb60 --- /dev/null +++ b/uni.scss @@ -0,0 +1,76 @@ +/** + * 这里是uni-app内置的常用样式变量 + * + * uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量 + * 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App + * + */ + +/** + * 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能 + * + * 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件 + */ + +/* 颜色变量 */ + +/* 行为相关颜色 */ +$uni-color-primary: #007aff; +$uni-color-success: #4cd964; +$uni-color-warning: #f0ad4e; +$uni-color-error: #dd524d; + +/* 文字基本颜色 */ +$uni-text-color: #333; //基本色 +$uni-text-color-inverse: #fff; //反色 +$uni-text-color-grey: #999; //辅助灰色,如加载更多的提示信息 +$uni-text-color-placeholder: #808080; +$uni-text-color-disable: #c0c0c0; + +/* 背景颜色 */ +$uni-bg-color: #ffffff; +$uni-bg-color-grey: #f8f8f8; +$uni-bg-color-hover: #f1f1f1; //点击状态颜色 +$uni-bg-color-mask: rgba(0, 0, 0, 0.4); //遮罩颜色 + +/* 边框颜色 */ +$uni-border-color: #c8c7cc; + +/* 尺寸变量 */ + +/* 文字尺寸 */ +$uni-font-size-sm: 12px; +$uni-font-size-base: 14px; +$uni-font-size-lg: 16px; + +/* 图片尺寸 */ +$uni-img-size-sm: 20px; +$uni-img-size-base: 26px; +$uni-img-size-lg: 40px; + +/* Border Radius */ +$uni-border-radius-sm: 2px; +$uni-border-radius-base: 3px; +$uni-border-radius-lg: 6px; +$uni-border-radius-circle: 50%; + +/* 水平间距 */ +$uni-spacing-row-sm: 5px; +$uni-spacing-row-base: 10px; +$uni-spacing-row-lg: 15px; + +/* 垂直间距 */ +$uni-spacing-col-sm: 4px; +$uni-spacing-col-base: 8px; +$uni-spacing-col-lg: 12px; + +/* 透明度 */ +$uni-opacity-disabled: 0.3; // 组件禁用态的透明度 + +/* 文章场景相关 */ +$uni-color-title: #2c405a; // 文章标题颜色 +$uni-font-size-title: 20px; +$uni-color-subtitle: #555555; // 二级标题颜色 +$uni-font-size-subtitle: 26px; +$uni-color-paragraph: #3f536e; // 文章段落颜色 +$uni-font-size-paragraph: 15px; diff --git a/utils/request.js b/utils/request.js new file mode 100644 index 0000000..41f5236 --- /dev/null +++ b/utils/request.js @@ -0,0 +1,57 @@ +// 导入模块 +import Request from 'luch-request'; +// import { userStore } from '@/store/index.js'; + +// const user = userStore(); + +let refToken = ''; +uni.getStorage({ + key: 'storage_token', + success(res) { + refToken = res.data; + } +}); + +// 实例化网络请求 +const http = new Request({ + // 接口基地址 + baseURL: import.meta.env.VITE_BASE_URL, + loading: true +}); + +//配置请求拦截器 +http.interceptors.request.use( + (config) => { + config.header = { + token: import.meta.env.VITE_TOKEN || refToken, + ...config.header + }; + return config; + }, + (responce) => { + return Promise.reject(response); + } +); +// 响应拦截器 +http.interceptors.response.use( + function ({ statusCode, data, config }) { + // if (config.data.code == 200) { + // uni.showLoading(); + // } + // 隐藏加载状态提示; + // uni.showLoading(); + // 解构出响应主体; + return data; + }, + function (error) { + uni.showLoading(); + if (error.data.code === 401) { + // 关闭提示 + + uni.showLoading(); + } + return Promise.reject(error); + } +); +// 导出配置好的模网络模块 +export { http };