From 78b705251c27cef419a17598acfd0afcd4d5fa81 Mon Sep 17 00:00:00 2001 From: chenkainan Date: Tue, 1 Jul 2025 16:39:26 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages.json | 331 ++++++++----- utils/request.js | 118 +++++ xxdf/chapter1/cover1.vue | 133 +++++ xxdf/chapter1/detail1.vue | 193 ++++++++ xxdf/chapter1/detail2.vue | 193 ++++++++ xxdf/chapter1/detail3.vue | 188 ++++++++ xxdf/chapter1/detail4.vue | 239 +++++++++ xxdf/chapter1/detail5.vue | 187 ++++++++ xxdf/chapter2/cover.vue | 201 ++++++++ xxdf/chapter3/cover.vue | 276 +++++++++++ xxdf/chapter3/randomImage.vue | 90 ++++ xxdf/chapter4/cover.vue | 880 ++++++++++++++++++++++++++++++++++ 12 files changed, 2906 insertions(+), 123 deletions(-) create mode 100644 utils/request.js create mode 100644 xxdf/chapter1/cover1.vue create mode 100644 xxdf/chapter1/detail1.vue create mode 100644 xxdf/chapter1/detail2.vue create mode 100644 xxdf/chapter1/detail3.vue create mode 100644 xxdf/chapter1/detail4.vue create mode 100644 xxdf/chapter1/detail5.vue create mode 100644 xxdf/chapter2/cover.vue create mode 100644 xxdf/chapter3/cover.vue create mode 100644 xxdf/chapter3/randomImage.vue create mode 100644 xxdf/chapter4/cover.vue diff --git a/pages.json b/pages.json index 3dd8fcc..e8c83e9 100644 --- a/pages.json +++ b/pages.json @@ -42,143 +42,228 @@ } }, { - "path" : "pages/login/login", - "style" : { - "navigationBarTitleText" : "登录", + "path": "pages/login/login", + "style": { + "navigationBarTitleText": "登录", "navigationStyle": "custom" } } ], "subPackages": [{ - "root": "subPackages", - "pages": [ - { - "path" : "order/trades", - "style" : { - "navigationBarTitleText" : "全部订单" - } - }, - { - "path" : "order/detail", - "style" : { - "navigationBarTitleText" : "订单详情", - "navigationStyle": "custom" - } - }, - { - "path": "techan/index", + "root": "subPackages", + "pages": [{ + "path": "order/trades", + "style": { + "navigationBarTitleText": "全部订单" + } + }, + { + "path": "order/detail", + "style": { + "navigationBarTitleText": "订单详情", + "navigationStyle": "custom" + } + }, + { + "path": "techan/index", + "style": { + "navigationBarTitleText": "", + "navigationStyle": "custom" + } + }, + { + "path": "techan/detail", + "style": { + "navigationBarTitleText": "" + } + }, + { + "path": "techan/order", + "style": { + "navigationBarTitleText": "确认订单" + } + }, + + { + "path": "webPage/webPage", + "style": { + "navigationBarTitleText": "" + } + }, + { + "path": "video/video", + "style": { + "navigationBarTitleText": "" + } + }, + { + "path": "readingBody/index", + "style": { + "navigationBarTitleText": "阅读体", + "navigationStyle": "custom" + } + }, + { + "path": "haveFeeling/shopDetail", + "style": { + "navigationBarTitleText": "有感商店详情页", + "navigationStyle": "custom" + } + }, + { + "path": "haveFeeling/detailXiang", + "style": { + "navigationBarTitleText": "有感商店" + } + }, + { + "path": "letter/detail", + "style": { + "navigationBarTitleText": "文章详情" + } + }, + { + "path": "user/privacy", + "style": { + "navigationBarTitleText": "详情" + } + }, + { + "path": "user/privacyInfo", + "style": { + "navigationBarTitleText": "详情" + } + }, + { + "path": "user/travelerList", + "style": { + "navigationBarTitleText": "收货地址" + } + }, + { + "path": "user/myAddressAdd", + "style": { + "navigationBarTitleText": "收货地址" + } + }, + { + "path": "user/gwc", + "style": { + "navigationBarTitleText": "购物车" + } + }, + { + "path": "user/profile", + "style": { + "navigationBarTitleText": "个人信息" + } + }, + { + "path": "user/changeNickname", + "style": { + "navigationBarTitleText": "修改昵称" + } + } + ] + }, + { + "root": "xxdf", + "pages": [{ + "path": "home/home", "style": { "navigationBarTitleText": "", "navigationStyle": "custom" } - }, - { - "path": "techan/detail", - "style": { - "navigationBarTitleText": "" + }] + }, + { + "root": "xxdf/chapter1", + "pages": [{ + "path": "cover1", + "style": { + "navigationBarTitleText": "", + "navigationStyle": "custom" + } + }, + { + "path": "detail1", + "style": { + "navigationBarTitleText": "", + "navigationStyle": "custom" + } + }, + { + "path": "detail2", + "style": { + "navigationBarTitleText": "", + "navigationStyle": "custom" + } + }, + { + "path": "detail3", + "style": { + "navigationBarTitleText": "", + "navigationStyle": "custom" + } + }, + { + "path": "detail4", + "style": { + "navigationBarTitleText": "", + "navigationStyle": "custom" + } + }, + { + "path": "detail5", + "style": { + "navigationBarTitleText": "", + "navigationStyle": "custom" + } } - }, - { - "path": "techan/order", + ] + }, + { + "root": "xxdf/chapter2", + "pages": [{ + "path": "cover", "style": { - "navigationBarTitleText": "确认订单" - } - }, - - { - "path" : "webPage/webPage", - "style" : { - "navigationBarTitleText" : "" - } - }, - { - "path" : "video/video", - "style" : { - "navigationBarTitleText" : "" - } - }, - { - "path" : "readingBody/index", - "style" : { - "navigationBarTitleText" : "阅读体", - "navigationStyle": "custom" - } - }, - { - "path" : "haveFeeling/shopDetail", - "style" : { - "navigationBarTitleText" : "有感商店详情页", + "navigationBarTitleText": "", "navigationStyle": "custom" - } - }, - { - "path" : "haveFeeling/detailXiang", - "style" : { - "navigationBarTitleText" : "有感商店" - } - }, - { - "path": "letter/detail", - "style": { - "navigationBarTitleText": "文章详情" - } - }, - { - "path" : "user/privacy", - "style" : { - "navigationBarTitleText" : "详情" - } - }, - { - "path" : "user/privacyInfo", - "style" : { - "navigationBarTitleText" : "详情" - } - }, - { - "path" : "user/travelerList", - "style" : { - "navigationBarTitleText" : "收货地址" - } - }, - { - "path" : "user/myAddressAdd", - "style" : { - "navigationBarTitleText" : "收货地址" } - }, - { - "path" : "user/gwc", - "style" : { - "navigationBarTitleText" : "购物车" + }] + }, + { + "root": "xxdf/chapter3", + "pages": [{ + "path": "cover", + "style": { + "navigationBarTitleText": "", + "navigationStyle": "custom" + } + }, + { + "path": "randomImage", + "style": { + "navigationBarTitleText": "", + "navigationStyle": "custom" + } } - }, - { - "path": "user/profile", + + ] + }, + { + "root": "xxdf/chapter4", + "pages": [{ + "path": "cover", "style": { - "navigationBarTitleText": "个人信息" + "navigationBarTitleText": "", + "navigationStyle": "custom", + "enableShareAppMessage": true, + "enableShareTimeline": true } - }, - { - "path" : "user/changeNickname", - "style" : { - "navigationBarTitleText" : "修改昵称" - } - } - ] - }, - { - "root": "xxdf", - "pages": [ - { - "path" : "home/home", - "style" : { - "navigationBarTitleText" : "", - "navigationStyle": "custom" - } - } - ] - }], + }] + } + ], "tabBar": { "custom": true, "color": "#333333", @@ -213,7 +298,7 @@ "text": "iSoul", "visible": false } - + ] }, "globalStyle": { @@ -223,4 +308,4 @@ "backgroundColor": "#F8F8F8" }, "uniIdRouter": {} -} +} \ No newline at end of file diff --git a/utils/request.js b/utils/request.js new file mode 100644 index 0000000..a039e45 --- /dev/null +++ b/utils/request.js @@ -0,0 +1,118 @@ +// utils/request.js + +/** + * 封装请求函数 + * @param {Object} options - 请求选项 + * @param {string} options.url - 请求URL + * @param {string} options.method - 请求方法: GET, POST, PUT, DELETE + * @param {Object} options.data - 请求参数 + * @param {Object} options.header - 请求头 + * @returns {Promise} - 返回Promise对象 + */ +export const request = (options = {}) => { + return new Promise((resolve, reject) => { + // 默认配置 + const defaultOptions = { + url: '', + method: 'GET', + data: {}, + header: { + 'content-type': 'application/json' + }, + timeout: 10000 // 10秒超时 + }; + + // 合并配置 + const mergedOptions = {...defaultOptions, ...options}; + + // 处理URL + if (!mergedOptions.url) { + reject(new Error('URL不能为空')); + return; + } + + // 调用uni.request + uni.request({ + url: mergedOptions.url, + method: mergedOptions.method, + data: mergedOptions.data, + header: mergedOptions.header, + timeout: mergedOptions.timeout, + success: (res) => { + // 请求成功 + if (res.statusCode >= 200 && res.statusCode < 300) { + resolve(res.data); + } else { + // 服务器返回错误 + reject({ + statusCode: res.statusCode, + errMsg: `请求失败,状态码: ${res.statusCode}`, + data: res.data + }); + } + }, + fail: (err) => { + // 请求失败 + reject(err); + } + }); + }); +}; + +/** + * GET请求快捷方法 + * @param {string} url - 请求URL + * @param {Object} data - 请求参数 + * @param {Object} options - 其他选项 + */ +export const get = (url, data = {}, options = {}) => { + return request({ + url, + method: 'GET', + data, + ...options + }); +}; + +/** + * POST请求快捷方法 + * @param {string} url - 请求URL + * @param {Object} data - 请求参数 + * @param {Object} options - 其他选项 + */ +export const post = (url, data = {}, options = {}) => { + return request({ + url, + method: 'POST', + data, + ...options + }); +}; + +/** + * 上传文件快捷方法 + * @param {string} url - 上传URL + * @param {string} filePath - 文件路径 + * @param {string} name - 文件对应的key + * @param {Object} formData - 附加的表单数据 + */ +export const uploadFile = (url, filePath, name = 'file', formData = {}) => { + return new Promise((resolve, reject) => { + uni.uploadFile({ + url, + filePath, + name, + formData, + success: (res) => { + try { + // 尝试解析JSON + const data = JSON.parse(res.data); + resolve(data); + } catch (e) { + resolve(res.data); + } + }, + fail: reject + }); + }); +}; diff --git a/xxdf/chapter1/cover1.vue b/xxdf/chapter1/cover1.vue new file mode 100644 index 0000000..1a26084 --- /dev/null +++ b/xxdf/chapter1/cover1.vue @@ -0,0 +1,133 @@ + + + + + \ No newline at end of file diff --git a/xxdf/chapter1/detail1.vue b/xxdf/chapter1/detail1.vue new file mode 100644 index 0000000..ab87a78 --- /dev/null +++ b/xxdf/chapter1/detail1.vue @@ -0,0 +1,193 @@ + + + + + + \ No newline at end of file diff --git a/xxdf/chapter1/detail2.vue b/xxdf/chapter1/detail2.vue new file mode 100644 index 0000000..ac631a1 --- /dev/null +++ b/xxdf/chapter1/detail2.vue @@ -0,0 +1,193 @@ + + + + + + \ No newline at end of file diff --git a/xxdf/chapter1/detail3.vue b/xxdf/chapter1/detail3.vue new file mode 100644 index 0000000..93f3397 --- /dev/null +++ b/xxdf/chapter1/detail3.vue @@ -0,0 +1,188 @@ + + + + + + \ No newline at end of file diff --git a/xxdf/chapter1/detail4.vue b/xxdf/chapter1/detail4.vue new file mode 100644 index 0000000..d5de160 --- /dev/null +++ b/xxdf/chapter1/detail4.vue @@ -0,0 +1,239 @@ + + + + + + \ No newline at end of file diff --git a/xxdf/chapter1/detail5.vue b/xxdf/chapter1/detail5.vue new file mode 100644 index 0000000..8f8b368 --- /dev/null +++ b/xxdf/chapter1/detail5.vue @@ -0,0 +1,187 @@ + + + + + + \ No newline at end of file diff --git a/xxdf/chapter2/cover.vue b/xxdf/chapter2/cover.vue new file mode 100644 index 0000000..c32ef1b --- /dev/null +++ b/xxdf/chapter2/cover.vue @@ -0,0 +1,201 @@ + + + + + + \ No newline at end of file diff --git a/xxdf/chapter3/cover.vue b/xxdf/chapter3/cover.vue new file mode 100644 index 0000000..371607e --- /dev/null +++ b/xxdf/chapter3/cover.vue @@ -0,0 +1,276 @@ + + + + + \ No newline at end of file diff --git a/xxdf/chapter3/randomImage.vue b/xxdf/chapter3/randomImage.vue new file mode 100644 index 0000000..3b9f1ed --- /dev/null +++ b/xxdf/chapter3/randomImage.vue @@ -0,0 +1,90 @@ + + + + + \ No newline at end of file diff --git a/xxdf/chapter4/cover.vue b/xxdf/chapter4/cover.vue new file mode 100644 index 0000000..6078af7 --- /dev/null +++ b/xxdf/chapter4/cover.vue @@ -0,0 +1,880 @@ + + + + + + \ No newline at end of file