1
0
mirror of https://github.com/ialley-workshop-open/uni-halo.git synced 2026-06-12 13:19:31 +08:00

新增:文章详情原文链接、访问密码功能

This commit is contained in:
小莫唐尼
2023-06-08 20:48:15 +08:00
parent d701867b83
commit 21d723d260
5 changed files with 1273 additions and 1139 deletions
+19
View File
@@ -153,3 +153,22 @@
transform: scale(1); transform: scale(1);
} }
} }
/* 文本省略样式 开始 */
.text-sub-one {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
/* 多行文本省略 */
@for $i from 2 through 30 {
.text-sub-more-#{$i} {
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: $i;
overflow: hidden;
}
}
/* 文本省略样式 结束 */
+165 -156
View File
@@ -3,183 +3,192 @@
<view v-if="loadStatus == 'loading'" class="img-loading" :style="[imgStyle, loadStyle]"> <view v-if="loadStatus == 'loading'" class="img-loading" :style="[imgStyle, loadStyle]">
<!-- <text class="img-load-icon iconfont icon-loading"></text> <!-- <text class="img-load-icon iconfont icon-loading"></text>
<text class="img-load-text">{{ loadText }}</text> --> <text class="img-load-text">{{ loadText }}</text> -->
<image :src="loadingImgSrc" :style="[imgStyle]" mode="aspectFit"></image> <image :src="loadingImgSrc" :style="[loadingImgStyle]" mode="aspectFit"></image>
</view> </view>
<view v-if="loadStatus == 'error'" class="img-error" :style="[imgStyle, loadErrStyle]"> <view v-if="loadStatus == 'error'" class="img-error" :style="[imgStyle, loadErrStyle]">
<text class="img-err-icon iconfont icon-exclamation-circle"></text> <!-- <text class="img-err-icon iconfont icon-exclamation-circle"></text>
<text class="img-load-text">{{ loadErrText }}</text> <text class="img-load-text">{{ loadErrText }}</text> -->
<image class="img-error-img" :src="loadingErrorImageSrc" mode="scaleToFill"></image>
</view> </view>
<image <image v-show="loadStatus == 'success'" :src="src" @load="fnOnLoad" @error="fnOnError" :lazy-load="lazyLoad" :style="[imgStyle]" :mode="mode" @click="$emit('on-click', url)"></image>
v-show="loadStatus == 'success'"
:src="src"
@load="fnOnLoad"
@error="fnOnError"
:lazy-load="lazyLoad"
:style="[imgStyle]"
:mode="mode"
@click="$emit('on-click', url)"
></image>
</view> </view>
</template> </template>
<script> <script>
import imageCache from '@/utils/imageCache.js'; import imageCache from '@/utils/imageCache.js';
export default { export default {
name: 'cache-image', name: 'cache-image',
props: { props: {
url: { url: {
type: String, type: String,
default: '' default: ''
}, },
lazyLoad: { lazyLoad: {
type: Boolean, type: Boolean,
default: true default: true
}, },
loadStyle: { loadStyle: {
type: Object, type: Object,
default() { default () {
return { return {
backgroundColor: '#ffffff', backgroundColor: '#ffffff',
color: '#333' color: '#333'
}; };
}
},
loadErrStyle: {
type: Object,
default () {
return {
color: 'rgba(244, 67, 54,1)'
// backgroundColor: 'rgba(244, 67, 54,0.2)'
};
}
},
mode: {
type: String,
default: 'aspectFill'
},
loadText: {
type: String,
default: '加载中...'
},
loadErrText: {
type: String,
default: '加载失败'
},
fileMd5: {
type: String,
default: ''
},
styles: {
type: Object,
default () {
return {};
}
},
width: {
type: String,
default: '100%'
},
height: {
type: String,
default: '100%'
},
radius: {
type: String,
default: ''
} }
}, },
loadErrStyle: { data() {
type: Object, return {
default() { imgStyle: {},
return { loadingImgStyle: {
color: 'rgba(244, 67, 54,1)' width: '120rpx',
// backgroundColor: 'rgba(244, 67, 54,0.2)' },
}; src: '', // 图片地址
loadStatus: 'loading'
};
},
computed: {
loadingImgSrc() {
return getApp().globalData.loadingGifUrl;
},
loadingErrorImageSrc() {
return getApp().globalData.loadingErrUrl
} }
}, },
mode: { watch: {
type: String, // 监听图片md5值的变化
default: 'aspectFill' fileMd5(val) {
}, // 查找获取图片缓存
loadText: { this.fnGetImageCache();
type: String,
default: '加载中...'
},
loadErrText: {
type: String,
default: '加载失败'
},
fileMd5: {
type: String,
default: ''
},
styles: {
type: Object,
default() {
return {};
} }
}, },
width: { created() {
type: String, console.log('cache-image', this.url);
default: '100%' this.imgStyle = {
}, width: this.width,
height: { height: this.height,
type: String, borderRadius: this.radius,
default: '100%' ...this.styles
}, };
radius: {
type: String,
default: ''
}
},
data() {
return {
imgStyle: {},
src: '', // 图片地址
loadStatus: 'loading'
};
},
computed: {
loadingImgSrc() {
return getApp().globalData.loadingGifUrl;
}
},
watch: {
// 监听图片md5值的变化
fileMd5(val) {
// 查找获取图片缓存 // 查找获取图片缓存
this.fnGetImageCache(); this.fnGetImageCache();
} },
}, methods: {
created() { // 查找获取图片缓存
console.log('cache-image', this.url); async fnGetImageCache() {
this.imgStyle = { // #ifdef APP-PLUS
width: this.width, var result = await imageCache.getImageCache(this.url, this.fileMd5);
height: this.height, if (result) {
borderRadius: this.radius, this.src = result;
...this.styles } else {
}; this.src = this.url;
}
// 查找获取图片缓存 // #endif
this.fnGetImageCache(); // #ifndef APP-PLUS
},
methods: {
// 查找获取图片缓存
async fnGetImageCache() {
// #ifdef APP-PLUS
var result = await imageCache.getImageCache(this.url, this.fileMd5);
if (result) {
this.src = result;
} else {
this.src = this.url; this.src = this.url;
// #endif
},
fnOnLoad() {
this.loadStatus = 'success';
},
fnOnError(e) {
this.loadStatus = 'error';
} }
// #endif
// #ifndef APP-PLUS
this.src = this.url;
// #endif
},
fnOnLoad() {
this.loadStatus = 'success';
},
fnOnError() {
this.loadStatus = 'error';
} }
} };
};
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.cache-image-wrap { .cache-image-wrap {
width: 100%; width: 100%;
height: 100%; height: 100%;
}
.img-loading,
.img-error {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
box-sizing: border-box;
background-color: #f2f2f2;
}
.img-load-icon {
font-size: 36rpx;
animation: xhRote 0.8s infinite linear;
}
.img-load-text {
font-size: 28rpx;
margin-top: 8rpx;
color: inherit;
}
.img-error {
font-size: 28rpx;
}
.img-err-icon {
font-size: 36rpx;
}
@keyframes xhRote {
0% {
transform: rotate(0deg);
} }
100% { .img-loading,
transform: rotate(360deg); .img-error {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
box-sizing: border-box;
background-color: #f2f2f2;
} }
}
</style> .img-load-icon {
font-size: 36rpx;
animation: xhRote 0.8s infinite linear;
}
.img-load-text {
font-size: 28rpx;
margin-top: 8rpx;
color: inherit;
}
.img-error {
font-size: 28rpx;
&-img {
width: 100%;
border-radius: 12rpx;
}
}
.img-err-icon {
font-size: 36rpx;
}
@keyframes xhRote {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
</style>
+216 -216
View File
@@ -1,217 +1,217 @@
{ {
"name": "uni-halo", "name" : "uni-halo",
"appid": "__UNI__5748B6E", "appid" : "__UNI__5748B6E",
"description": "uni-halo博客:基于halo开源博客系统API开发的多端博客。", "description" : "uni-halo博客:基于halo开源博客系统API开发的多端博客。",
"versionName": "1.0.0", "versionName" : "1.0.0",
"versionCode": 100, "versionCode" : 100,
"transformPx": false, "transformPx" : false,
/* 5+App */ /* 5+App */
"app-plus": { "app-plus" : {
"usingComponents": true, "usingComponents" : true,
"nvueStyleCompiler": "uni-app", "nvueStyleCompiler" : "uni-app",
"compilerVersion": 3, "compilerVersion" : 3,
"splashscreen": { "splashscreen" : {
"alwaysShowBeforeRender": true, "alwaysShowBeforeRender" : true,
"waiting": true, "waiting" : true,
"autoclose": true, "autoclose" : true,
"delay": 0 "delay" : 0
}, },
/* */ /* */
"modules": { "modules" : {
"OAuth": {}, "OAuth" : {},
"Share": {} "Share" : {}
}, },
/* */ /* */
"distribute": { "distribute" : {
/* android */ /* android */
"android": { "android" : {
"permissions": [ "permissions" : [
"<uses-feature android:name=\"android.hardware.camera\"/>", "<uses-feature android:name=\"android.hardware.camera\"/>",
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>", "<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>", "<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>", "<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
"<uses-permission android:name=\"android.permission.CAMERA\"/>", "<uses-permission android:name=\"android.permission.CAMERA\"/>",
"<uses-permission android:name=\"android.permission.CAPTURE_VIDEO_OUTPUT\"/>", "<uses-permission android:name=\"android.permission.CAPTURE_VIDEO_OUTPUT\"/>",
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>", "<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>", "<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>", "<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>", "<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
"<uses-permission android:name=\"android.permission.MODIFY_AUDIO_SETTINGS\"/>", "<uses-permission android:name=\"android.permission.MODIFY_AUDIO_SETTINGS\"/>",
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>", "<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>", "<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>", "<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
"<uses-permission android:name=\"android.permission.VIBRATE\"/>", "<uses-permission android:name=\"android.permission.VIBRATE\"/>",
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>", "<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>" "<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
] ]
}, },
/* ios */ /* ios */
"ios": { "ios" : {
"dSYMs": false, "dSYMs" : false,
"capabilities": { "capabilities" : {
"entitlements": { "entitlements" : {
"com.apple.developer.associated-domains": ["applinks:static-699a26a5-a6cd-4b54-b603-5155b312a5f5.bspapp.com"] "com.apple.developer.associated-domains" : [ "applinks:static-699a26a5-a6cd-4b54-b603-5155b312a5f5.bspapp.com" ]
} }
} }
}, },
/* SDK */ /* SDK */
"sdkConfigs": { "sdkConfigs" : {
"ad": { "ad" : {
"gdt": {}, "gdt" : {},
"csj": {}, "csj" : {},
"360": {}, "360" : {},
"ks": {}, "ks" : {},
"sigmob": {}, "sigmob" : {},
"hw": {}, "hw" : {},
"bd": {} "bd" : {}
}, },
"oauth": { "oauth" : {
"weixin": { "weixin" : {
"appid": "wxd971954762ec4744", "appid" : "wxd971954762ec4744",
"UniversalLinks": "https://static-699a26a5-a6cd-4b54-b603-5155b312a5f5.bspapp.com/uni-universallinks/__UNI__5748B6E/" "UniversalLinks" : "https://static-699a26a5-a6cd-4b54-b603-5155b312a5f5.bspapp.com/uni-universallinks/__UNI__5748B6E/"
} }
}, },
"share": { "share" : {
"weixin": { "weixin" : {
"appid": "wxd971954762ec4744", "appid" : "wxd971954762ec4744",
"UniversalLinks": "https://static-699a26a5-a6cd-4b54-b603-5155b312a5f5.bspapp.com/uni-universallinks/__UNI__5748B6E/" "UniversalLinks" : "https://static-699a26a5-a6cd-4b54-b603-5155b312a5f5.bspapp.com/uni-universallinks/__UNI__5748B6E/"
} }
} }
}, },
"icons": { "icons" : {
"android": { "android" : {
"hdpi": "unpackage/res/icons/72x72.png", "hdpi" : "unpackage/res/icons/72x72.png",
"xhdpi": "unpackage/res/icons/96x96.png", "xhdpi" : "unpackage/res/icons/96x96.png",
"xxhdpi": "unpackage/res/icons/144x144.png", "xxhdpi" : "unpackage/res/icons/144x144.png",
"xxxhdpi": "unpackage/res/icons/192x192.png" "xxxhdpi" : "unpackage/res/icons/192x192.png"
}, },
"ios": { "ios" : {
"appstore": "unpackage/res/icons/1024x1024.png", "appstore" : "unpackage/res/icons/1024x1024.png",
"ipad": { "ipad" : {
"app": "unpackage/res/icons/76x76.png", "app" : "unpackage/res/icons/76x76.png",
"app@2x": "unpackage/res/icons/152x152.png", "app@2x" : "unpackage/res/icons/152x152.png",
"notification": "unpackage/res/icons/20x20.png", "notification" : "unpackage/res/icons/20x20.png",
"notification@2x": "unpackage/res/icons/40x40.png", "notification@2x" : "unpackage/res/icons/40x40.png",
"proapp@2x": "unpackage/res/icons/167x167.png", "proapp@2x" : "unpackage/res/icons/167x167.png",
"settings": "unpackage/res/icons/29x29.png", "settings" : "unpackage/res/icons/29x29.png",
"settings@2x": "unpackage/res/icons/58x58.png", "settings@2x" : "unpackage/res/icons/58x58.png",
"spotlight": "unpackage/res/icons/40x40.png", "spotlight" : "unpackage/res/icons/40x40.png",
"spotlight@2x": "unpackage/res/icons/80x80.png" "spotlight@2x" : "unpackage/res/icons/80x80.png"
}, },
"iphone": { "iphone" : {
"app@2x": "unpackage/res/icons/120x120.png", "app@2x" : "unpackage/res/icons/120x120.png",
"app@3x": "unpackage/res/icons/180x180.png", "app@3x" : "unpackage/res/icons/180x180.png",
"notification@2x": "unpackage/res/icons/40x40.png", "notification@2x" : "unpackage/res/icons/40x40.png",
"notification@3x": "unpackage/res/icons/60x60.png", "notification@3x" : "unpackage/res/icons/60x60.png",
"settings@2x": "unpackage/res/icons/58x58.png", "settings@2x" : "unpackage/res/icons/58x58.png",
"settings@3x": "unpackage/res/icons/87x87.png", "settings@3x" : "unpackage/res/icons/87x87.png",
"spotlight@2x": "unpackage/res/icons/80x80.png", "spotlight@2x" : "unpackage/res/icons/80x80.png",
"spotlight@3x": "unpackage/res/icons/120x120.png" "spotlight@3x" : "unpackage/res/icons/120x120.png"
} }
} }
} }
}, },
"uniStatistics": { "uniStatistics" : {
"enable": true "enable" : true
} }
}, },
/* */ /* */
"quickapp": {}, "quickapp" : {},
/* */ /* */
"mp-weixin": { "mp-weixin" : {
"appid": "wx1bb161867082c72f", "appid" : "wx1bb161867082c72f",
"setting": { "setting" : {
"urlCheck": false, "urlCheck" : false,
"minified": true "minified" : true
}, },
"usingComponents": true, "usingComponents" : true,
"uniStatistics": { "uniStatistics" : {
"enable": true "enable" : true
} }
}, },
"mp-alipay": { "mp-alipay" : {
"usingComponents": true, "usingComponents" : true,
"uniStatistics": { "uniStatistics" : {
"enable": true "enable" : true
} }
}, },
"mp-baidu": { "mp-baidu" : {
"usingComponents": true, "usingComponents" : true,
"uniStatistics": { "uniStatistics" : {
"enable": true "enable" : true
} }
}, },
"mp-toutiao": { "mp-toutiao" : {
"usingComponents": true, "usingComponents" : true,
"uniStatistics": { "uniStatistics" : {
"enable": true "enable" : true
} }
}, },
"uniStatistics": { "uniStatistics" : {
"enable": true, "enable" : true,
"version": "2" "version" : "2"
}, },
"vueVersion": "2", "vueVersion" : "2",
"h5": { "h5" : {
"title": "uni-halo", "title" : "uni-halo",
"devServer": { "devServer" : {
"disableHostCheck": true, "disableHostCheck" : true,
"proxy": { "proxy" : {
"/api": { "/api" : {
"target": "https://b.925i.cn", "target" : "https://b.925i.cn",
"changeOrigin": true, "changeOrigin" : true,
"secure": false, "secure" : false,
"pathRewrite": { "pathRewrite" : {
"^/api": "/api" "^/api" : "/api"
} }
} }
} }
}, },
"optimization": { "optimization" : {
"preload": true, "preload" : true,
"treeShaking": { "treeShaking" : {
"enable": true "enable" : true
} }
}, },
"uniStatistics": { "uniStatistics" : {
"enable": true "enable" : true
} }
}, },
"_spaceID": "699a26a5-a6cd-4b54-b603-5155b312a5f5", "_spaceID" : "699a26a5-a6cd-4b54-b603-5155b312a5f5",
"mp-qq": { "mp-qq" : {
"appid": "1112285420", "appid" : "1112285420",
"setting": { "setting" : {
"minified": true, "minified" : true,
"postcss": true, "postcss" : true,
"es6": true "es6" : true
}, },
"uniStatistics": { "uniStatistics" : {
"enable": true "enable" : true
} }
}, },
"mp-jd": { "mp-jd" : {
"uniStatistics": { "uniStatistics" : {
"enable": true "enable" : true
} }
}, },
"mp-kuaishou": { "mp-kuaishou" : {
"uniStatistics": { "uniStatistics" : {
"enable": true "enable" : true
} }
}, },
"mp-lark": { "mp-lark" : {
"uniStatistics": { "uniStatistics" : {
"enable": true "enable" : true
} }
}, },
"quickapp-webview-huawei": { "quickapp-webview-huawei" : {
"uniStatistics": { "uniStatistics" : {
"enable": true "enable" : true
} }
}, },
"quickapp-webview-union": { "quickapp-webview-union" : {
"uniStatistics": { "uniStatistics" : {
"enable": true "enable" : true
} }
} }
} }
+2 -2
View File
@@ -550,7 +550,7 @@
}, },
"tabBar": { "tabBar": {
"backgroundColor": "#fff", "backgroundColor": "#fff",
"borderStyle": "#fff", "borderStyle": "white",
"color": "#303133", "color": "#303133",
"selectedColor": "#03a9f4", "selectedColor": "#03a9f4",
"list": [{ "list": [{
@@ -582,4 +582,4 @@
} }
] ]
} }
} }
File diff suppressed because it is too large Load Diff