diff --git a/DCLOUD.md b/DCLOUD.md
index 582c029..e7f206d 100644
--- a/DCLOUD.md
+++ b/DCLOUD.md
@@ -1,7 +1,7 @@
## 简介
-目前以实现个人博客,资源收集下载,网盘短剧视频链接分享,手机壁纸下载,电脑壁纸下载,头像下载,支持 100+ 热门平台的图片视频水印去除,这些内容展示均已实现小程序流量主功能,可根据自己需要进行配置,
+目前已实现个人博客、资源收集下载、网盘短剧视频链接分享、手机壁纸下载、电脑壁纸下载和头像下载,这些内容展示均已实现小程序流量主功能,可根据自己需要进行配置,
另外还加入了积分系统以及积分任务和积分商店,可让用户完成相应的任务获得积分换取奖励,源码无保留可二次开发,话不多说看图最重要。
diff --git a/README.md b/README.md
index fe8959c..84c1c33 100644
--- a/README.md
+++ b/README.md
@@ -1,140 +1,37 @@
-
-
-
-依沫博客资源
-基于UniApp开发
-
-
-
+# 南音博客 (依沫博客)
-## 平台简介
+这是一个基于 **uni-app (Vue 2)** 和 **uView UI** 框架开发的微信小程序/多端应用项目。
+本项目是一个功能丰富的资源分享类博客系统,包含完善的用户体系和商业化/积分玩法,集成了“文章阅读 + 资源/壁纸下载 + 短剧观看 + 积分商城 + 抽奖活动 + 支付充值”的综合性内容变现功能。
-依沫博客资源变现专为内容资源下载场景设计,一站式解决内容带货、流量、资源变现,资源博客文章分享难题,目前以实现个人博客,文章发表,资源收集下载,网盘短剧视频链接分享,手机壁纸下载,电脑壁纸下载,头像下载,支持抖音,快手,小红书等 100+ 平台的图片视频水印去除,这些内容展示均已实现微信小程序流量主广告变现功能,可根据自己需要进行配置,
-另外还加入了积分系统以及积分任务和积分商店,可让用户完成相应的任务获得积分换取奖励,源码无保留可二次开发。
+## 核心功能模块
-* 应用框架基于[uniapp](https://uniapp.dcloud.net.cn/),支持小程序、H5、Android和IOS。(流量主流量变现广告目前只支持微信小程序)
-* 前端组件采用[uni-ui](https://github.com/dcloudio/uni-ui),全端兼容的高性能UI框架。
-* 阿里云服务器免费试用3个月,新老用户同享 99/年:[点我进入](https://www.aliyun.com/daily-act/ecs/activity_selection?userCode=ua4mkdxk)
-* 需要后端代码请打开微信搜索公众号关注 "依沫资源网" 或微信扫面下方二维码关注微信公众号发送 "依沫博客后端源码" 即可获取
+### 1. 文章与博客系统
+- **文章流与详情**:支持文章列表查询与详情展示。
+- **富文本与代码高亮**:内置 `mp-html` 组件,集成 `marked` 和 `prismjs`,完美支持 Markdown 渲染和代码高亮展示。
+- **互动功能**:支持文章点赞和阅读量统计。
-
+### 2. 资源与壁纸分享
+- **资源系统**:提供虚拟资源的展示与详情查看,支持消耗积分兑换并下载资源。
+- **壁纸系统**:提供壁纸列表浏览及高清图片下载功能。
-## 技术文档
+### 3. 短剧模块
+- 提供当前热门短剧资源的列表浏览及观看体验。
-[//]: # (
QQ: 1149297946 或 微信:yimoziyuan666)
-- 运行之前请安装uview-ui组件依赖,可打开项目根目录运行 cmd 输入 npm install uview-ui
-- 如需微信小程序运行或实现微信流量主小程序流量变现请修改 manifest.json 微信小程序的AppID,以及在后台管理端的App配置项配置自己的广告id
-- 打开微信扫描下面的小程序码即可体验小程序
+### 4. 积分与商城经济系统
+- **积分获取**:包含每日签到、积分新增记录、积分明细查看。
+- **充值与支付**:支持创建充值订单,并更新用户积分余额。
+- **积分商城**:用户可使用积分兑换实物商品或虚拟资源,并支持查看兑换记录。
-
+### 5. 抽奖系统
+- 内置抽奖玩法,包含抽奖次数校验、概率生成、奖品配置查看、奖励发放以及抽奖记录展示。
-## 故障排除
-
-### uni-search-bar 组件路径错误
-
-如果在编译时遇到以下错误:
-```
-pages/search/index.json: ["usingComponents"]["uni-search-bar"]: "/node-modules/uni_modules/uni-search-bar/components/uni-search-bar/uni-search-bar",在 D:/codes/git/yimo-resource-blog-master/unpackage/dist/dev/mp-weixin/node-modules/uni_modules/uni-search-bar/components/uni-search-bar/uni-search-bar 路径下未找到组件
-```
-
-**解决方案:**
-
-1. **清理编译缓存**
- ```bash
- # Windows 命令行
- rmdir /s /q unpackage
-
- # 或者直接删除 unpackage 目录
- ```
-
-2. **检查 pages.json 配置**
- 确保 `pages.json` 中的 `easycom` 配置包含了 uni_modules 组件的正确匹配规则:
- ```json
- "easycom": {
- "^u-(.*)": "uview-ui/components/u-$1/u-$1.vue",
- "^uni-(.*)": "@/uni_modules/uni-$1/components/uni-$1/uni-$1.vue"
- }
- ```
-
-3. **确认组件存在**
- 检查 `uni_modules/uni-search-bar/components/uni-search-bar/uni-search-bar.vue` 文件是否存在。
-
-4. **重新编译项目**
- - 在 HBuilderX 中:运行 → 运行到小程序模拟器 → 微信开发者工具
- - 或使用命令行工具重新编译
-
-**说明:**
-- uni-app 的 easycom 机制会自动注册符合命名规范的组件
-- 项目中的 uni-search-bar 组件位于 `uni_modules` 目录下,是标准的 uni_modules 组件
-- 错误中的 `node-modules` 路径是编译过程中的临时路径,实际组件路径应该是 `uni_modules`
-- 清理缓存可以解决大部分编译路径缓存问题
-
-### 其他常见问题
-
-- **组件不显示**:确保已正确配置 easycom 或手动引入组件
-- **编译错误**:检查 pages.json 语法,确保 JSON 格式正确
-- **路径错误**:使用相对路径时注意 `@/` 表示项目根目录
-
-## 技术支持
-
-- 如有问题欢迎联系作者
-
-
-
- | 微信 |
- QQ |
-
-
-  |
-  |
-
-
- | YiMoZiYuan666 |
- 1149297946 |
-
-
-
-## 小程序部分演示图
-
-
-
-  |
-  |
-  |
-
-
-  |
-  |
-  |
-
-
-  |
-  |
-  |
-
-
-  |
-  |
-  |
-
-
-  |
-  |
-  |
-
-
-
-## PC端部分演示图 在线演示[www.emoboy.vip](https://www.emoboy.vip)
-
-
-
-
-## 管理后台部分演示图
-
-
-
-
-
-
-* 若您喜欢对您有帮助的话,麻烦客官动动发财的手给小二一个 Star ,您的支持是我们不断进步的源泉!!!
+### 6. 用户与权限中心
+- **登录注册**:支持账号密码登录、注册,以及微信授权自动/快捷登录。
+- **状态管理**:基于 `Vuex` 集中管理用户 Token、基础信息(头像、昵称)等。
+- **权限控制**:基于 JWT 的权限认证体系,封装了 `$auth` 插件,支持基于角色和权限的细粒度鉴权。
+- **网络拦截**:封装统一的 `request.js`,支持 Token 自动携带、响应拦截、过期自动弹窗跳转等。
+## 技术栈
+- 前端框架:uni-app (Vue 2)
+- UI 框架:uView UI
+- 状态管理:Vuex
diff --git a/api/app/index.js b/api/app/index.js
index d735a7e..4879d53 100644
--- a/api/app/index.js
+++ b/api/app/index.js
@@ -53,9 +53,9 @@ export function getResource(id) {
}
// 查询资源详细
-export function getResourceByUserId(id, userId) {
+export function getResourceByUserId(id) {
return request({
- url: '/app/resource/app/user/' + id + '/' + userId,
+ url: '/app/resource/app/user/' + id,
method: 'get'
})
}
@@ -95,16 +95,7 @@ export function listGoods(query) {
})
}
-// 微信登录获取openid
-export function autoLoginWx(code) {
- return request({
- url: '/app/public/autoLoginWx/' + code,
- method: 'get'
- })
-}
-
-
-// 新增文章
+// 微信临时 code 登录,OpenID 和 session_key 仅由后端获取
export function wxLogin(data) {
return request({
url: '/wxLogin',
@@ -192,23 +183,6 @@ export function exchangeResource(data) {
}
-// 去水印
-export function delShuiYin(data) {
- return request({
- url: '/app/public/delSHuiYin',
- method: 'post',
- data: data
- })
-}
-
-// 新增安全域名配置
-export function addNewDownloadUrl(url) {
- return request({
- url: '/app/public/addNewDownloadUrl/' + url,
- method: 'get'
- })
-}
-
// 获取系统配置数据
export function getSysSet() {
return request({
@@ -280,20 +254,22 @@ export function listLotteryLog(query) {
})
}
-// 创建充值订单
-export function createRechargeOrder(data) {
+// 创建资源虚拟支付订单
+export function createVirtualResourceOrder(data) {
return request({
- url: '/app/pay/createOrder',
+ url: '/app/virtual-pay/resource-orders',
method: 'post',
data: data
})
}
-// 更新用户积分
-export function updateUserPoints(data) {
+// 查询资源虚拟支付订单
+export function getVirtualResourceOrder(orderNo, sync) {
return request({
- url: '/app/pay/updatePoints',
- method: 'post',
- data: data
+ url: '/app/virtual-pay/resource-orders/' + orderNo,
+ method: 'get',
+ params: {
+ sync: !!sync
+ }
})
}
diff --git a/components/lun-bo-tu/lun-bo-tu.vue b/components/lun-bo-tu/lun-bo-tu.vue
index 844c082..61f7e3d 100644
--- a/components/lun-bo-tu/lun-bo-tu.vue
+++ b/components/lun-bo-tu/lun-bo-tu.vue
@@ -1,8 +1,10 @@
-
-
+
+
+
+
@@ -16,27 +18,35 @@
default() {
return []
}
- },
- urlKey: {
- type: String,
- default() {
- return ''
- }
}
},
data() {
return {
currentIndex: 0,
dontFirstAnimation: true,
+ failedImages: {},
+ }
+ },
+ watch: {
+ imgList() {
+ this.failedImages = {}
}
},
methods: {
+ imageSource(item, index) {
+ if (this.failedImages[index] && item.fallbackImage) {
+ return item.fallbackImage
+ }
+ return item.image
+ },
+ imageError(item, index) {
+ if (!this.failedImages[index] && item.fallbackImage && item.fallbackImage !== item.image) {
+ this.$set(this.failedImages, index, true)
+ }
+ },
swiperChange(e) {
this.dontFirstAnimation = false
this.currentIndex = e.detail.current
- },
- clickImg(item) {
- this.$emit('selected', item, this.currentIndex)
}
}
}
@@ -78,6 +88,13 @@
.image-container {
height: 360rpx;
}
+ .carousel-link {
+ width: 100%;
+ height: 100%;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ }
.item-img {
width: 650rpx;
diff --git a/pages.json b/pages.json
index a5a59da..141ff76 100644
--- a/pages.json
+++ b/pages.json
@@ -74,14 +74,6 @@
"enablePullDownRefresh" : true
}
},
- {
- "path" : "pages/tool/video",
- "style" :
- {
- "navigationBarTitleText" : "演示视频",
- "enablePullDownRefresh" : false
- }
- },
{
"path" : "pages/tool/software",
"style" :
@@ -127,7 +119,7 @@
"path" : "pages/mine/integral_record",
"style" :
{
- "navigationBarTitleText" : "积分记录",
+ "navigationBarTitleText" : "消费记录",
"enablePullDownRefresh" : false
}
},
@@ -139,14 +131,6 @@
"enablePullDownRefresh" : false
}
},
- {
- "path": "pages/mine/recharge",
- "style": {
- "navigationBarTitleText": "充值积分",
- "navigationBarBackgroundColor": "#ffffff",
- "navigationBarTextStyle": "black"
- }
- },
{
"path" : "pages/tool/avatar",
"style" :
@@ -164,38 +148,6 @@
"navigationStyle": "custom"
}
},
- {
- "path" : "pages/tool/shuiyin",
- "style" :
- {
- "navigationBarTitleText" : "水印去除",
- "enablePullDownRefresh" : false
- }
- },
- {
- "path" : "pages/tool/shuiyin/problem",
- "style" :
- {
- "navigationBarTitleText" : "教程和问题",
- "enablePullDownRefresh" : false
- }
- },
- {
- "path" : "pages/tool/shuiyin/image",
- "style" :
- {
- "navigationBarTitleText" : "解析结果",
- "enablePullDownRefresh" : false
- }
- },
- {
- "path" : "pages/tool/shuiyin/video",
- "style" :
- {
- "navigationBarTitleText" : "解析结果",
- "enablePullDownRefresh" : false
- }
- },
{
"path" : "pages/tool/phone",
"style" :
diff --git a/pages/blog/bloginfo.vue b/pages/blog/bloginfo.vue
index 38d3db7..addaf96 100644
--- a/pages/blog/bloginfo.vue
+++ b/pages/blog/bloginfo.vue
@@ -11,7 +11,7 @@
-
+
@@ -53,7 +53,7 @@
-
+
@@ -69,7 +69,7 @@
-
+
@@ -85,7 +85,7 @@
说明:{{blogInfo.remark}}
说明:请先点击下方按钮即可获取文章详情,由于存储与服务器成本很高不得已部分内容需您观看激励视频广告
@@ -111,7 +111,7 @@
点赞
-
+
@@ -370,8 +370,16 @@
})
})
},
- download(id) {
- this.$tab.navigateTo('/pages/blog/resource?id=' + id + "&type=1")
+ download() {
+ const id = this.blogInfo && this.blogInfo.appResourceId
+ if (!id) {
+ uni.showToast({
+ title: '资源信息不存在',
+ icon: 'none'
+ })
+ return
+ }
+ this.$tab.navigateTo('/pages/blog/resource?id=' + encodeURIComponent(id) + "&type=1")
},
back(val) {
const pages = getCurrentPages();
@@ -778,4 +786,4 @@
z-index: 1025;
background-color: #fff;
}
-
\ No newline at end of file
+
diff --git a/pages/blog/resource.vue b/pages/blog/resource.vue
index ef9d760..7220f6b 100644
--- a/pages/blog/resource.vue
+++ b/pages/blog/resource.vue
@@ -3,7 +3,7 @@
-
+
@@ -45,7 +45,8 @@
复制下方链接打开手机浏览器进行下载!!!
请先点击下方按钮即可获取资源下载列表!
-
+
+
@@ -56,6 +57,7 @@
{{item.listUrl}}复制
+
@@ -65,13 +67,16 @@
-
+
广告查看
积分获取( {{resourceInfo.adNumber}} 积分 )
+
+ {{paying ? '支付结果确认中...' : '付费获取( ¥' + formatPrice(resourceInfo.priceFen) + ' )'}}
+
@@ -79,7 +84,8 @@
\ No newline at end of file
diff --git a/pages/search/index.vue b/pages/search/index.vue
index 5c93a4b..6653050 100644
--- a/pages/search/index.vue
+++ b/pages/search/index.vue
@@ -4,13 +4,13 @@
文章搜索
- 悬悬而望
+ 发现优质资源
- 愿我们都不后悔,出现在彼此的世界中
+ 软件、源码与实用内容,在这里轻松找到
-
@@ -41,16 +41,17 @@
-
+
{{item.title}}
-
-
-
-
+
+
+
+
+
{{item.createTime}}{{item.lookNumber}}
@@ -467,4 +468,4 @@
.info-icon {
height: 40rpx;
}
-
\ No newline at end of file
+
diff --git a/pages/tool/avatar.vue b/pages/tool/avatar.vue
index b4cc468..0c796d4 100644
--- a/pages/tool/avatar.vue
+++ b/pages/tool/avatar.vue
@@ -38,7 +38,7 @@
-
+
免费获取
@@ -621,4 +621,4 @@
margin: 20rpx auto;
overflow: hidden;
}
-
\ No newline at end of file
+
diff --git a/pages/tool/computer.vue b/pages/tool/computer.vue
index fcbe2dc..7bba589 100644
--- a/pages/tool/computer.vue
+++ b/pages/tool/computer.vue
@@ -38,7 +38,7 @@
-
+
免费获取
@@ -434,4 +434,4 @@
margin: 20rpx auto;
overflow: hidden;
}
-
\ No newline at end of file
+
diff --git a/pages/tool/exchange.vue b/pages/tool/exchange.vue
index 8f8b6c5..5f75e06 100644
--- a/pages/tool/exchange.vue
+++ b/pages/tool/exchange.vue
@@ -60,7 +60,7 @@
-
+
@@ -701,4 +701,4 @@
}
}
}
-
\ No newline at end of file
+
diff --git a/pages/tool/exchangeinfo.vue b/pages/tool/exchangeinfo.vue
index 10133e3..3d78188 100644
--- a/pages/tool/exchangeinfo.vue
+++ b/pages/tool/exchangeinfo.vue
@@ -3,7 +3,7 @@
-
+
@@ -474,4 +474,4 @@
}
}
}
-
\ No newline at end of file
+
diff --git a/pages/tool/freeCode.vue b/pages/tool/freeCode.vue
index ff7a9fc..f45f751 100644
--- a/pages/tool/freeCode.vue
+++ b/pages/tool/freeCode.vue
@@ -32,16 +32,18 @@
-
+
{{item.title}}
-
-
-
-
+
+
+
+
+
+
{{item.createTime}}{{item.lookNumber}}
diff --git a/pages/tool/highQualityCode.vue b/pages/tool/highQualityCode.vue
index ed96632..825c713 100644
--- a/pages/tool/highQualityCode.vue
+++ b/pages/tool/highQualityCode.vue
@@ -32,16 +32,18 @@
-
+
{{item.title}}
-
-
-
-
+
+
+
+
+
+
{{item.createTime}}{{item.lookNumber}}
diff --git a/pages/tool/index.vue b/pages/tool/index.vue
index 2e6dadb..6c686d5 100644
--- a/pages/tool/index.vue
+++ b/pages/tool/index.vue
@@ -33,36 +33,6 @@
color: 'cyan',
cuIcon: 'https://img.yidaima.cn/zyk.png'
},
- {
- title: '手机壁纸',
- name: 'wallpaper',
- color: 'purple',
- cuIcon: 'https://img.yidaima.cn/sjbz.png'
- },
- {
- title: '电脑壁纸',
- name: 'computer',
- color: 'pink',
- cuIcon: 'https://img.yidaima.cn/dnbz.png'
- },
- {
- title: '精美头像',
- name: 'avatar',
- color: 'brown',
- cuIcon: 'https://img.yidaima.cn/jmtx.png'
- },
- {
- title: '视频资源',
- name: 'video',
- color: 'blue',
- cuIcon: 'https://img.yidaima.cn/sp.png'
- },
- {
- title: '水印去除',
- name: 'shuiyin',
- color: 'red',
- cuIcon: 'https://img.yidaima.cn/sycc.png'
- },
{
title: '手机软件',
name: 'phone',
@@ -74,12 +44,6 @@
name: 'software',
color: 'mauve',
cuIcon: 'https://img.yidaima.cn/dnrj.png'
- },
- {
- title: '积分兑换',
- name: 'exchange',
- color: 'green',
- cuIcon: 'https://img.yidaima.cn/jfdh.png'
}
],
};
@@ -110,4 +74,4 @@
background-color: #FFFFFF;
z-index: 1;
}
-
\ No newline at end of file
+
diff --git a/pages/tool/phone.vue b/pages/tool/phone.vue
index e54e107..4883ef1 100644
--- a/pages/tool/phone.vue
+++ b/pages/tool/phone.vue
@@ -26,12 +26,12 @@
-
+
-
-
+
+
{{item.resourceTitle}}
获取详情
@@ -347,4 +347,4 @@
overflow: hidden;
position: relative;
}
-
\ No newline at end of file
+
diff --git a/pages/tool/resource.vue b/pages/tool/resource.vue
index 205d999..d136c0a 100644
--- a/pages/tool/resource.vue
+++ b/pages/tool/resource.vue
@@ -26,12 +26,12 @@
-
+
-
-
+
+
{{item.resourceTitle}}
获取详情
@@ -348,4 +348,4 @@
overflow: hidden;
position: relative;
}
-
\ No newline at end of file
+
diff --git a/pages/tool/shuiyin.vue b/pages/tool/shuiyin.vue
deleted file mode 100644
index c145214..0000000
--- a/pages/tool/shuiyin.vue
+++ /dev/null
@@ -1,424 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 水印去除
-
-
-
-
-
-
- 消耗 积分 或者看 视频广告 之后自动获取,存储与传输成本很高不得已加入广告回回血
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/pages/tool/shuiyin/image.vue b/pages/tool/shuiyin/image.vue
deleted file mode 100644
index 8467ff9..0000000
--- a/pages/tool/shuiyin/image.vue
+++ /dev/null
@@ -1,286 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/pages/tool/shuiyin/problem.vue b/pages/tool/shuiyin/problem.vue
deleted file mode 100644
index b56811f..0000000
--- a/pages/tool/shuiyin/problem.vue
+++ /dev/null
@@ -1,170 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/pages/tool/shuiyin/video.vue b/pages/tool/shuiyin/video.vue
deleted file mode 100644
index baff092..0000000
--- a/pages/tool/shuiyin/video.vue
+++ /dev/null
@@ -1,421 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/pages/tool/software.vue b/pages/tool/software.vue
index c6a55c6..63ba54d 100644
--- a/pages/tool/software.vue
+++ b/pages/tool/software.vue
@@ -26,12 +26,12 @@
-
+
-
-
+
+
{{item.resourceTitle}}
获取详情
@@ -347,4 +347,4 @@
overflow: hidden;
position: relative;
}
-
\ No newline at end of file
+
diff --git a/pages/tool/wallpaper.vue b/pages/tool/wallpaper.vue
index c1f3a5b..449c800 100644
--- a/pages/tool/wallpaper.vue
+++ b/pages/tool/wallpaper.vue
@@ -38,7 +38,7 @@
-
+
免费获取
@@ -440,4 +440,4 @@
margin: 20rpx auto;
overflow: hidden;
}
-
\ No newline at end of file
+
diff --git a/plugins/index.js b/plugins/index.js
index efbae15..862f695 100644
--- a/plugins/index.js
+++ b/plugins/index.js
@@ -1,6 +1,7 @@
import tab from './tab'
import auth from './auth'
import modal from './modal'
+import image from '@/utils/image'
export default {
install(Vue) {
@@ -10,5 +11,7 @@ export default {
Vue.prototype.$auth = auth
// 模态框对象
Vue.prototype.$modal = modal
+ // CDN image normalization and responsive thumbnail helpers
+ Vue.prototype.$image = image
}
}
diff --git a/static/home/index-bg.jpg b/static/home/index-bg.jpg
new file mode 100644
index 0000000..5634ec0
Binary files /dev/null and b/static/home/index-bg.jpg differ
diff --git a/static/mine/default-avatar.jpg b/static/mine/default-avatar.jpg
new file mode 100644
index 0000000..d0b4b1b
Binary files /dev/null and b/static/mine/default-avatar.jpg differ
diff --git a/static/mine/default-profile-bg.jpg b/static/mine/default-profile-bg.jpg
new file mode 100644
index 0000000..562d001
Binary files /dev/null and b/static/mine/default-profile-bg.jpg differ
diff --git a/static/payment/resource-item-99-small.jpg b/static/payment/resource-item-99-small.jpg
new file mode 100644
index 0000000..54ac77a
Binary files /dev/null and b/static/payment/resource-item-99-small.jpg differ
diff --git a/static/payment/resource-item-99.png b/static/payment/resource-item-99.png
new file mode 100644
index 0000000..3383ff8
Binary files /dev/null and b/static/payment/resource-item-99.png differ
diff --git a/utils/image.js b/utils/image.js
new file mode 100644
index 0000000..6e9a84d
--- /dev/null
+++ b/utils/image.js
@@ -0,0 +1,69 @@
+const CDN_HOST = 'img.yidaima.cn'
+
+// JPEG is used deliberately here. Some older iOS/WeChat image decoders cannot
+// display the WebP thumbnails returned by Qiniu.
+const ARTICLE_CARD = 'imageView2/1/w/600/h/375/format/jpg/q/75/ignore-error/1'
+const RESOURCE_CARD = 'imageView2/1/w/500/h/400/format/jpg/q/75/ignore-error/1'
+
+function original(url) {
+ if (!url || typeof url !== 'string') {
+ return url || ''
+ }
+
+ const value = url.trim()
+ const httpPrefix = `http://${CDN_HOST}/`
+ if (value.indexOf(httpPrefix) === 0) {
+ return `https://${value.substring('http://'.length)}`
+ }
+ if (value.indexOf(`//${CDN_HOST}/`) === 0) {
+ return `https:${value}`
+ }
+ return value
+}
+
+function qiniuThumbnail(url, operation) {
+ const normalized = original(url)
+ if (!normalized || normalized.indexOf(`https://${CDN_HOST}/`) !== 0) {
+ return normalized
+ }
+ // Keep signed or already processed URLs intact.
+ if (normalized.indexOf('?') >= 0) {
+ return normalized
+ }
+ return `${normalized}?${operation}`
+}
+
+function compatibleThumbnail(url) {
+ const normalized = original(url)
+ if (!normalized) {
+ return ''
+ }
+
+ // The API may still return a cached showImgThumb containing format/webp.
+ // Rewrite that Qiniu operation on the client while the backend rolls over.
+ if (normalized.indexOf(`https://${CDN_HOST}/`) === 0) {
+ return normalized.replace(/\/format\/webp(?=\/|$)/i, '/format/jpg')
+ }
+ return normalized
+}
+
+function articleThumbnail(image) {
+ if (image && typeof image === 'object') {
+ return compatibleThumbnail(image.showImgThumb) || qiniuThumbnail(image.showImg, ARTICLE_CARD)
+ }
+ return qiniuThumbnail(image, ARTICLE_CARD)
+}
+
+function resourceThumbnail(image) {
+ if (image && typeof image === 'object') {
+ return compatibleThumbnail(image.showImgThumb) || qiniuThumbnail(image.showImg, RESOURCE_CARD)
+ }
+ return qiniuThumbnail(image, RESOURCE_CARD)
+}
+
+export default {
+ original,
+ compatibleThumbnail,
+ articleThumbnail,
+ resourceThumbnail
+}
diff --git a/utils/request.js b/utils/request.js
index 957038e..c0285d3 100644
--- a/utils/request.js
+++ b/utils/request.js
@@ -35,6 +35,7 @@ const request = config => {
let [error, res] = response
if (error) {
toast('请返回重试')
+ uni.hideLoading()
reject('请返回重试')
return
}
@@ -48,21 +49,27 @@ const request = config => {
})
}
})
+ uni.hideLoading()
reject('无效的会话,或者会话已过期,请重新登录。')
+ return
} else if (code === 500) {
setTimeout(()=>{
toast(msg)
},200);
+ uni.hideLoading()
reject('500')
+ return
} else if (code !== 200) {
toast(msg)
+ uni.hideLoading()
reject(code)
+ return
}
resolve(res.data)
uni.hideLoading()
})
.catch(error => {
- let { message } = error
+ let message = error && error.message ? error.message : '请求失败'
if (message === 'Network Error') {
message = '后端接口连接异常'
} else if (message.includes('timeout')) {