fix: 首页和我的应用排序按 seq 排列
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -1,258 +1,258 @@
|
||||
<template>
|
||||
<view :style="colorStyle">
|
||||
<view class="px-32">
|
||||
<view class="fs-36 fw-500 lh-54rpx mt-44">{{ articleInfo.title }}</view>
|
||||
<view class="flex fs-24 text--w111-999 mt-16">
|
||||
<text>{{ articleInfo.catename }}</text>
|
||||
<text class="px-16">|</text>
|
||||
<text>{{ articleInfo.add_time }}</text>
|
||||
</view>
|
||||
<view class="content fs-30 text--w111-333 lh-52rpx mt-32">
|
||||
<jyf-parser :html="content" ref="article" :tag-style="tagStyle"></jyf-parser>
|
||||
</view>
|
||||
<view class="bg--w111-f5f5f5 rd-24rpx w-full flex-between-center p-20 mt-32" @tap="goDetail" v-if="store_info.id">
|
||||
<image :src="store_info.image" class="w-160 h-160 rd-16rpx" mode="aspectFill"></image>
|
||||
<view class="flex-1 h-160 flex-col justify-between pl-20">
|
||||
<view class="w-full fs-28 lh-40rpx line2">{{ store_info.store_name }}</view>
|
||||
<view class="flex justify-between items-end">
|
||||
<baseMoney :money="store_info.price" symbolSize="28" integerSize="44" decimalSize="28" weight></baseMoney>
|
||||
<view class="w-136 h-52 rd-30rpx flex-center fs-22 text--w111-fff bg-gradient">立即购买</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="h-200"></view>
|
||||
<view class="bg--w111-fff w-full z-99 fixed-lb pb-safe">
|
||||
<view class="w-full h-128 px-32 flex-y-center" v-if="store_info.id">
|
||||
<view class="w-346 h-72 px-24 rd-36rpx flex-center bg--w111-f5f5f5" @tap="goDetail">
|
||||
<image :src="store_info.image" class="w-48 h-48 rd-8rpx"></image>
|
||||
<view class="pl-12">
|
||||
<view class="fs-22 fw-500 w-238 line1">{{ store_info.store_name }}</view>
|
||||
<view class="fs-20 SemiBold">¥{{ store_info.price }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex-1 flex-between-center ml-38">
|
||||
<view class=" flex-y-center">
|
||||
<text class="iconfont icon-ic_Eyes fs-38"></text>
|
||||
<text class="fs-26 pl-12">{{ articleInfo.visit }}</text>
|
||||
</view>
|
||||
<view class=" flex-y-center" :class="{ active: articleInfo.is_like }" @tap="giveLike">
|
||||
<text class="iconfont icon-ic_Like fs-38"></text>
|
||||
<text class="fs-26 pl-12">{{ articleInfo.likes }}</text>
|
||||
</view>
|
||||
<!-- #ifdef H5 -->
|
||||
<text class="iconfont icon-ic_share fs-44" @tap="listenerActionSheet"></text>
|
||||
<!-- #endif -->
|
||||
<!-- #ifdef MP -->
|
||||
<button open-type="share" hover-class="none">
|
||||
<text class="iconfont icon-ic_share fs-38"></text>
|
||||
</button>
|
||||
<!-- #endif -->
|
||||
</view>
|
||||
</view>
|
||||
<view class="w-full px-120 h-128 flex-between-center" v-else>
|
||||
<view class="flex-y-center" :class="{ active: articleInfo.is_like }" @tap="giveLike">
|
||||
<text class="iconfont icon-ic_Like fs-38"></text>
|
||||
<text class="fs-26 pl-12">{{ articleInfo.likes }}</text>
|
||||
</view>
|
||||
<view class="flex-y-center">
|
||||
<text class="iconfont icon-ic_Eyes fs-38"></text>
|
||||
<text class="fs-26 pl-12">{{ articleInfo.visit }}</text>
|
||||
</view>
|
||||
<!-- #ifdef H5 -->
|
||||
<text class="iconfont icon-ic_share fs-38" @tap="listenerActionSheet"></text>
|
||||
<!-- #endif -->
|
||||
<!-- #ifdef MP -->
|
||||
<button open-type="share" hover-class="none">
|
||||
<text class="iconfont icon-ic_share fs-44"></text>
|
||||
</button>
|
||||
<!-- #endif -->
|
||||
</view>
|
||||
</view>
|
||||
<shareInfo @setShareInfoStatus="setShareInfoStatus" :shareInfoStatus="shareInfoStatus"></shareInfo>
|
||||
<home></home>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getArticleDetails } from '@/api/api.js';
|
||||
import { articleStarApi, userShare } from '@/api/user.js';
|
||||
import shareInfo from '../components/shareInfo/index.vue';
|
||||
import parser from '@/components/jyf-parser/jyf-parser';
|
||||
import colors from '@/mixins/color';
|
||||
import { mapGetters } from 'vuex';
|
||||
import { toLogin } from '@/libs/login.js';
|
||||
import { HTTP_REQUEST_URL } from '@/config/app';
|
||||
export default {
|
||||
components: {
|
||||
shareInfo,
|
||||
'jyf-parser': parser
|
||||
},
|
||||
mixins: [colors],
|
||||
data() {
|
||||
return {
|
||||
id: 0,
|
||||
articleInfo: {},
|
||||
store_info: {},
|
||||
content: '',
|
||||
shareInfoStatus: false,
|
||||
tagStyle: {
|
||||
img: 'width:100%;display:block;border-radius:8px;',
|
||||
table: 'width:100%',
|
||||
video: 'width:100%;'
|
||||
}
|
||||
};
|
||||
},
|
||||
computed: mapGetters(['isLogin', 'uid']),
|
||||
onPageScroll(object) {
|
||||
uni.$emit('scroll');
|
||||
},
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
// #ifdef MP
|
||||
onShareAppMessage: function() {
|
||||
let that = this;
|
||||
return {
|
||||
title: that.articleInfo.title,
|
||||
imageUrl: that.articleInfo.image_input[0] || '',
|
||||
path: '/pages/extension/news_details/index?id=' + that.id + '&spid=' + that.uid
|
||||
};
|
||||
},
|
||||
onShareTimeline() {
|
||||
let that = this;
|
||||
return {
|
||||
title: that.articleInfo.title,
|
||||
imageUrl: that.articleInfo.image_input[0] || '',
|
||||
path: '/pages/extension/news_details/index?id=' + that.id + '&spid=' + that.uid
|
||||
};
|
||||
},
|
||||
// #endif
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
if (options.hasOwnProperty('id')) {
|
||||
this.id = options.id;
|
||||
} else {
|
||||
// #ifndef H5
|
||||
uni.navigateBack({ delta: 1 });
|
||||
// #endif
|
||||
// #ifdef H5
|
||||
history.back();
|
||||
// #endif
|
||||
}
|
||||
},
|
||||
onShow: function () {
|
||||
uni.removeStorageSync('form_type_cart');
|
||||
this.getArticleOne();
|
||||
},
|
||||
methods: {
|
||||
getArticleOne: function () {
|
||||
let that = this;
|
||||
getArticleDetails(that.id).then((res) => {
|
||||
uni.setNavigationBarTitle({
|
||||
title: res.data.title
|
||||
});
|
||||
that.$set(that, 'articleInfo', res.data);
|
||||
that.$set(that, 'store_info', res.data.store_info ? res.data.store_info : {});
|
||||
that.content = res.data.content;
|
||||
// #ifdef H5
|
||||
if (this.$wechat.isWeixin()) {
|
||||
this.setShareInfo();
|
||||
}
|
||||
// #endif
|
||||
});
|
||||
},
|
||||
giveLike() {
|
||||
if (!this.isLogin) {
|
||||
toLogin();
|
||||
} else {
|
||||
articleStarApi(this.id, {
|
||||
status: this.articleInfo.is_like ? 0 : 1
|
||||
}).then((res) => {
|
||||
let that = this;
|
||||
uni.showToast({
|
||||
title: this.articleInfo.is_like ? '取消点赞' : '点赞成功',
|
||||
icon: 'none',
|
||||
success: () => {
|
||||
if (this.articleInfo.is_like) {
|
||||
that.articleInfo.likes = that.articleInfo.likes - 1;
|
||||
that.articleInfo.is_like = 0;
|
||||
} else {
|
||||
that.articleInfo.likes = that.articleInfo.likes + 1;
|
||||
that.articleInfo.is_like = 1;
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
},
|
||||
goDetail() {
|
||||
uni.navigateTo({
|
||||
url: '/pages/goods_details/index?id=' + this.store_info.id
|
||||
});
|
||||
},
|
||||
listenerActionSheet() {
|
||||
if (this.$wechat.isWeixin()) {
|
||||
this.shareInfoStatus = true;
|
||||
} else {
|
||||
let that = this;
|
||||
uni.setClipboardData({
|
||||
data: HTTP_REQUEST_URL + '/pages/extension/news_details/index?id=' + that.id,
|
||||
success: () => {
|
||||
uni.showToast({
|
||||
title: '已复制页面链接'
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
setShareInfoStatus() {
|
||||
this.shareInfoStatus = false;
|
||||
},
|
||||
setShareInfo: function () {
|
||||
let href = location.href;
|
||||
let configAppMessage = {
|
||||
desc: this.articleInfo.synopsis,
|
||||
title: this.articleInfo.title,
|
||||
link: href,
|
||||
imgUrl: this.articleInfo.image_input.length ? this.articleInfo.image_input[0] : ''
|
||||
};
|
||||
this.$wechat.wechatEvevt(['updateAppMessageShareData', 'updateTimelineShareData'], configAppMessage);
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style>
|
||||
page {
|
||||
background-color: #ffffff;
|
||||
}
|
||||
</style>
|
||||
<style lang="scss">
|
||||
.active {
|
||||
color: var(--view-theme);
|
||||
}
|
||||
.content {
|
||||
// text-indent: 2em;
|
||||
}
|
||||
.ml-52 {
|
||||
margin-left: 52rpx;
|
||||
}
|
||||
.ml-80 {
|
||||
margin-left: 80rpx;
|
||||
}
|
||||
.abs-num {
|
||||
position: absolute;
|
||||
right: -26rpx;
|
||||
top: -10rpx;
|
||||
}
|
||||
.likes-num {
|
||||
position: absolute;
|
||||
right: -16rpx;
|
||||
top: -10rpx;
|
||||
}
|
||||
.SemiBold {
|
||||
font-family: 'SemiBold';
|
||||
}
|
||||
</style>
|
||||
<template>
|
||||
<view :style="colorStyle">
|
||||
<view class="px-32">
|
||||
<view class="fs-36 fw-500 lh-54rpx mt-44">{{ articleInfo.title }}</view>
|
||||
<view class="flex fs-24 text--w111-999 mt-16">
|
||||
<text>{{ articleInfo.catename }}</text>
|
||||
<text class="px-16">|</text>
|
||||
<text>{{ articleInfo.add_time }}</text>
|
||||
</view>
|
||||
<view class="content fs-30 text--w111-333 lh-52rpx mt-32">
|
||||
<jyf-parser :html="content" ref="article" :tag-style="tagStyle"></jyf-parser>
|
||||
</view>
|
||||
<view class="bg--w111-f5f5f5 rd-24rpx w-full flex-between-center p-20 mt-32" @tap="goDetail" v-if="store_info.id">
|
||||
<image :src="store_info.image" class="w-160 h-160 rd-16rpx" mode="aspectFill"></image>
|
||||
<view class="flex-1 h-160 flex-col justify-between pl-20">
|
||||
<view class="w-full fs-28 lh-40rpx line2">{{ store_info.store_name }}</view>
|
||||
<view class="flex justify-between items-end">
|
||||
<baseMoney :money="store_info.price" symbolSize="28" integerSize="44" decimalSize="28" weight></baseMoney>
|
||||
<view class="w-136 h-52 rd-30rpx flex-center fs-22 text--w111-fff bg-gradient">立即购买</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="h-200"></view>
|
||||
<view class="bg--w111-fff w-full z-99 fixed-lb pb-safe">
|
||||
<view class="w-full h-128 px-32 flex-y-center" v-if="store_info.id">
|
||||
<view class="w-346 h-72 px-24 rd-36rpx flex-center bg--w111-f5f5f5" @tap="goDetail">
|
||||
<image :src="store_info.image" class="w-48 h-48 rd-8rpx"></image>
|
||||
<view class="pl-12">
|
||||
<view class="fs-22 fw-500 w-238 line1">{{ store_info.store_name }}</view>
|
||||
<view class="fs-20 SemiBold">¥{{ store_info.price }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex-1 flex-between-center ml-38">
|
||||
<view class=" flex-y-center">
|
||||
<text class="iconfont icon-ic_Eyes fs-38"></text>
|
||||
<text class="fs-26 pl-12">{{ articleInfo.visit }}</text>
|
||||
</view>
|
||||
<view class=" flex-y-center" :class="{ active: articleInfo.is_like }" @tap="giveLike">
|
||||
<text class="iconfont icon-ic_Like fs-38"></text>
|
||||
<text class="fs-26 pl-12">{{ articleInfo.likes }}</text>
|
||||
</view>
|
||||
<!-- #ifdef H5 -->
|
||||
<text class="iconfont icon-ic_share fs-44" @tap="listenerActionSheet"></text>
|
||||
<!-- #endif -->
|
||||
<!-- #ifdef MP -->
|
||||
<button open-type="share" hover-class="none">
|
||||
<text class="iconfont icon-ic_share fs-38"></text>
|
||||
</button>
|
||||
<!-- #endif -->
|
||||
</view>
|
||||
</view>
|
||||
<view class="w-full px-120 h-128 flex-between-center" v-else>
|
||||
<view class="flex-y-center" :class="{ active: articleInfo.is_like }" @tap="giveLike">
|
||||
<text class="iconfont icon-ic_Like fs-38"></text>
|
||||
<text class="fs-26 pl-12">{{ articleInfo.likes }}</text>
|
||||
</view>
|
||||
<view class="flex-y-center">
|
||||
<text class="iconfont icon-ic_Eyes fs-38"></text>
|
||||
<text class="fs-26 pl-12">{{ articleInfo.visit }}</text>
|
||||
</view>
|
||||
<!-- #ifdef H5 -->
|
||||
<text class="iconfont icon-ic_share fs-38" @tap="listenerActionSheet"></text>
|
||||
<!-- #endif -->
|
||||
<!-- #ifdef MP -->
|
||||
<button open-type="share" hover-class="none">
|
||||
<text class="iconfont icon-ic_share fs-44"></text>
|
||||
</button>
|
||||
<!-- #endif -->
|
||||
</view>
|
||||
</view>
|
||||
<shareInfo @setShareInfoStatus="setShareInfoStatus" :shareInfoStatus="shareInfoStatus"></shareInfo>
|
||||
<home></home>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getArticleDetails } from '@/api/api.js';
|
||||
import { articleStarApi, userShare } from '@/api/user.js';
|
||||
import shareInfo from '../components/shareInfo/index.vue';
|
||||
import parser from '@/components/jyf-parser/jyf-parser';
|
||||
import colors from '@/mixins/color';
|
||||
import { mapGetters } from 'vuex';
|
||||
import { toLogin } from '@/libs/login.js';
|
||||
import { HTTP_REQUEST_URL } from '@/config/app';
|
||||
export default {
|
||||
components: {
|
||||
shareInfo,
|
||||
'jyf-parser': parser
|
||||
},
|
||||
mixins: [colors],
|
||||
data() {
|
||||
return {
|
||||
id: 0,
|
||||
articleInfo: {},
|
||||
store_info: {},
|
||||
content: '',
|
||||
shareInfoStatus: false,
|
||||
tagStyle: {
|
||||
img: 'width:100%;display:block;border-radius:8px;',
|
||||
table: 'width:100%',
|
||||
video: 'width:100%;'
|
||||
}
|
||||
};
|
||||
},
|
||||
computed: mapGetters(['isLogin', 'uid']),
|
||||
onPageScroll(object) {
|
||||
uni.$emit('scroll');
|
||||
},
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
// #ifdef MP
|
||||
onShareAppMessage: function() {
|
||||
let that = this;
|
||||
return {
|
||||
title: that.articleInfo.title,
|
||||
imageUrl: that.articleInfo.image_input[0] || '',
|
||||
path: '/pages/extension/news_details/index?id=' + that.id + '&spid=' + that.uid
|
||||
};
|
||||
},
|
||||
onShareTimeline() {
|
||||
let that = this;
|
||||
return {
|
||||
title: that.articleInfo.title,
|
||||
imageUrl: that.articleInfo.image_input[0] || '',
|
||||
path: '/pages/extension/news_details/index?id=' + that.id + '&spid=' + that.uid
|
||||
};
|
||||
},
|
||||
// #endif
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
if (options.hasOwnProperty('id')) {
|
||||
this.id = options.id;
|
||||
} else {
|
||||
// #ifndef H5
|
||||
uni.navigateBack({ delta: 1 });
|
||||
// #endif
|
||||
// #ifdef H5
|
||||
history.back();
|
||||
// #endif
|
||||
}
|
||||
},
|
||||
onShow: function () {
|
||||
uni.removeStorageSync('form_type_cart');
|
||||
this.getArticleOne();
|
||||
},
|
||||
methods: {
|
||||
getArticleOne: function () {
|
||||
let that = this;
|
||||
getArticleDetails(that.id).then((res) => {
|
||||
uni.setNavigationBarTitle({
|
||||
title: res.data.title
|
||||
});
|
||||
that.$set(that, 'articleInfo', res.data);
|
||||
that.$set(that, 'store_info', res.data.store_info ? res.data.store_info : {});
|
||||
that.content = res.data.content;
|
||||
// #ifdef H5
|
||||
if (this.$wechat.isWeixin()) {
|
||||
this.setShareInfo();
|
||||
}
|
||||
// #endif
|
||||
});
|
||||
},
|
||||
giveLike() {
|
||||
if (!this.isLogin) {
|
||||
toLogin();
|
||||
} else {
|
||||
articleStarApi(this.id, {
|
||||
status: this.articleInfo.is_like ? 0 : 1
|
||||
}).then((res) => {
|
||||
let that = this;
|
||||
uni.showToast({
|
||||
title: this.articleInfo.is_like ? '取消点赞' : '点赞成功',
|
||||
icon: 'none',
|
||||
success: () => {
|
||||
if (this.articleInfo.is_like) {
|
||||
that.articleInfo.likes = that.articleInfo.likes - 1;
|
||||
that.articleInfo.is_like = 0;
|
||||
} else {
|
||||
that.articleInfo.likes = that.articleInfo.likes + 1;
|
||||
that.articleInfo.is_like = 1;
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
},
|
||||
goDetail() {
|
||||
uni.navigateTo({
|
||||
url: '/pages/goods_details/index?id=' + this.store_info.id
|
||||
});
|
||||
},
|
||||
listenerActionSheet() {
|
||||
if (this.$wechat.isWeixin()) {
|
||||
this.shareInfoStatus = true;
|
||||
} else {
|
||||
let that = this;
|
||||
uni.setClipboardData({
|
||||
data: HTTP_REQUEST_URL + '/pages/extension/news_details/index?id=' + that.id,
|
||||
success: () => {
|
||||
uni.showToast({
|
||||
title: '已复制页面链接'
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
setShareInfoStatus() {
|
||||
this.shareInfoStatus = false;
|
||||
},
|
||||
setShareInfo: function () {
|
||||
let href = location.href;
|
||||
let configAppMessage = {
|
||||
desc: this.articleInfo.synopsis,
|
||||
title: this.articleInfo.title,
|
||||
link: href,
|
||||
imgUrl: this.articleInfo.image_input.length ? this.articleInfo.image_input[0] : ''
|
||||
};
|
||||
this.$wechat.wechatEvevt(['updateAppMessageShareData', 'updateTimelineShareData'], configAppMessage);
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style>
|
||||
page {
|
||||
background-color: #ffffff;
|
||||
}
|
||||
</style>
|
||||
<style lang="scss">
|
||||
.active {
|
||||
color: var(--view-theme);
|
||||
}
|
||||
.content {
|
||||
// text-indent: 2em;
|
||||
}
|
||||
.ml-52 {
|
||||
margin-left: 52rpx;
|
||||
}
|
||||
.ml-80 {
|
||||
margin-left: 80rpx;
|
||||
}
|
||||
.abs-num {
|
||||
position: absolute;
|
||||
right: -26rpx;
|
||||
top: -10rpx;
|
||||
}
|
||||
.likes-num {
|
||||
position: absolute;
|
||||
right: -16rpx;
|
||||
top: -10rpx;
|
||||
}
|
||||
.SemiBold {
|
||||
font-family: 'SemiBold';
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -415,7 +415,7 @@
|
||||
},
|
||||
watch:{
|
||||
reset(val){
|
||||
this.getCartList(1);
|
||||
if (this.isLogin) { this.getCartList(1); }
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
@@ -424,7 +424,7 @@
|
||||
this.getScrollHeight();
|
||||
}, 500);
|
||||
if(this.isLogin){
|
||||
this.getCartList(1);
|
||||
if (this.isLogin) { this.getCartList(1); }
|
||||
}
|
||||
uni.$on('newAttrNum', (data) => {
|
||||
if (data.length) {
|
||||
@@ -765,7 +765,7 @@
|
||||
item.cart_num = item.copy_cart_num;
|
||||
item.showInput =false;
|
||||
this.getCartNum();
|
||||
this.getCartList(1);
|
||||
if (this.isLogin) { this.getCartList(1); }
|
||||
})
|
||||
.catch(err => {
|
||||
item.copy_cart_num = item.cart_num;
|
||||
|
||||
@@ -380,7 +380,7 @@
|
||||
},
|
||||
watch:{
|
||||
reset(val){
|
||||
this.getCartList(1);
|
||||
if (this.isLogin) { this.getCartList(1); }
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
@@ -389,7 +389,7 @@
|
||||
this.getScrollHeight();
|
||||
}, 500)
|
||||
if(this.isLogin){
|
||||
this.getCartList(1);
|
||||
if (this.isLogin) { this.getCartList(1); }
|
||||
}
|
||||
uni.$on('newAttrNum', (data) => {
|
||||
if (data.length) {
|
||||
@@ -689,7 +689,7 @@
|
||||
item.cart_num = item.copy_cart_num;
|
||||
item.showInput =false;
|
||||
this.getCartNum();
|
||||
this.getCartList(1);
|
||||
if (this.isLogin) { this.getCartList(1); }
|
||||
})
|
||||
.catch(err => {
|
||||
item.copy_cart_num = item.cart_num;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
275
pages/index/components/appCenter.vue
Normal file
275
pages/index/components/appCenter.vue
Normal file
@@ -0,0 +1,275 @@
|
||||
<template>
|
||||
<view v-if="showApps" :style="[boxStyle]">
|
||||
<view :style="[boxContentStyle]">
|
||||
<view class="list-menu" :style="[gridColumns]">
|
||||
<view
|
||||
class="item flex-col flex-center"
|
||||
v-for="(item, index) in displayList"
|
||||
:key="index"
|
||||
@click="onAppTap(item)"
|
||||
>
|
||||
<!-- 更多按钮 -->
|
||||
<template v-if="item._isMore">
|
||||
<view class="img-box skeleton-radius" v-if="menuStyleConfig !== 2">
|
||||
<view class="more-icon-inner flex-col flex-center">
|
||||
<view class="more-dots">
|
||||
<view class="more-dot"></view>
|
||||
<view class="more-dot"></view>
|
||||
<view class="more-dot"></view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<text
|
||||
class="fs-24"
|
||||
:class="{ 'mt-14': menuStyleConfig == 0 }"
|
||||
:style="[nameColorStyle]"
|
||||
v-if="menuStyleConfig !== 1"
|
||||
>更多</text>
|
||||
</template>
|
||||
<!-- 普通应用 -->
|
||||
<template v-else>
|
||||
<view class="img-box skeleton-radius" v-if="menuStyleConfig !== 2">
|
||||
<image
|
||||
:src="item.logo"
|
||||
mode="aspectFill"
|
||||
:style="{ borderRadius: (imgStyle * 2) + 'rpx' }"
|
||||
v-if="item.logo"
|
||||
></image>
|
||||
<view class="empty-box" v-else></view>
|
||||
</view>
|
||||
<text
|
||||
class="fs-24"
|
||||
:class="{ 'mt-14': menuStyleConfig == 0 }"
|
||||
:style="[nameColorStyle]"
|
||||
v-if="menuStyleConfig !== 1"
|
||||
>{{ item.name }}</text>
|
||||
</template>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
const STORAGE_KEY = 'MY_HOME_APPS'
|
||||
const MAX_HOME_APPS = 6
|
||||
|
||||
export default {
|
||||
name: 'appCenter',
|
||||
props: {
|
||||
dataConfig: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
menuStyleConfig() {
|
||||
return this.dataConfig.menuStyleConfig?.tabVal ?? 0
|
||||
},
|
||||
number() {
|
||||
return this.dataConfig.number?.tabVal ?? 0
|
||||
},
|
||||
boxStyle() {
|
||||
return {
|
||||
padding: `${(this.dataConfig.topConfig?.val ?? 0) * 2}rpx ${(this.dataConfig.prConfig?.val ?? 0) * 2}rpx ${(this.dataConfig.bottomConfig?.val ?? 0) * 2}rpx`,
|
||||
marginTop: `${(this.dataConfig.mbConfig?.val ?? 0) * 2}rpx`,
|
||||
background: this.dataConfig.bottomBgColor?.color?.[0]?.item ?? 'transparent'
|
||||
}
|
||||
},
|
||||
boxContentStyle() {
|
||||
let borderRadius = `${(this.dataConfig.fillet?.val ?? 0) * 2}rpx`
|
||||
if (this.dataConfig.fillet?.type) {
|
||||
const vl = this.dataConfig.fillet.valList || []
|
||||
borderRadius = `${(vl[0]?.val ?? 0) * 2}rpx ${(vl[1]?.val ?? 0) * 2}rpx ${(vl[3]?.val ?? 0) * 2}rpx ${(vl[2]?.val ?? 0) * 2}rpx`
|
||||
}
|
||||
return {
|
||||
borderRadius,
|
||||
background: `linear-gradient(90deg, ${this.dataConfig.bgColor?.color?.[0]?.item ?? '#fff'} 0%, ${this.dataConfig.bgColor?.color?.[1]?.item ?? '#fff'} 100%)`
|
||||
}
|
||||
},
|
||||
imgStyle() {
|
||||
return this.dataConfig.filletImg?.val ?? 0
|
||||
},
|
||||
gridColumns() {
|
||||
// 应用中心用 4 列固定网格
|
||||
return {
|
||||
gridTemplateColumns: `repeat(4, 1fr)`
|
||||
}
|
||||
},
|
||||
nameColorStyle() {
|
||||
return {
|
||||
color: this.dataConfig.nameColor?.color?.[0]?.item ?? '#333333'
|
||||
}
|
||||
},
|
||||
// 是否在首页展示
|
||||
showApps() {
|
||||
return this.homeApps.showOnHome && this.displayList.length > 0
|
||||
},
|
||||
// 已选应用的 id 集合(快速查找)
|
||||
selectedIds() {
|
||||
return new Set(this.homeApps.appIds || [])
|
||||
},
|
||||
// 最终展示列表(过滤 + 按 seq 排序 + 截取 + 追加"更多")
|
||||
displayList() {
|
||||
const ids = this.homeApps.appIds || []
|
||||
if (!ids.length) return []
|
||||
|
||||
const idSet = new Set(ids)
|
||||
// 按 allApps API 返回顺序排列(即后台设置的 seq 顺序)
|
||||
const filtered = this.allApps.filter(item => idSet.has(item.id))
|
||||
const indexMap = new Map(this.allApps.map((item, i) => [item.id, i]))
|
||||
filtered.sort((a, b) => (indexMap.get(a.id) ?? 999) - (indexMap.get(b.id) ?? 999))
|
||||
const sliced = filtered.slice(0, MAX_HOME_APPS)
|
||||
|
||||
// 追加"更多"条目
|
||||
sliced.push({
|
||||
_isMore: true,
|
||||
name: '更多'
|
||||
})
|
||||
|
||||
return sliced
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
allApps: [],
|
||||
homeApps: {
|
||||
showOnHome: true,
|
||||
appIds: []
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.loadHomeApps()
|
||||
this.fetchApps()
|
||||
},
|
||||
// 从个人中心编辑保存后跳回首页时,重新读取 storage
|
||||
onShow() {
|
||||
this.loadHomeApps()
|
||||
},
|
||||
methods: {
|
||||
// 读取本地存储的首页应用配置
|
||||
loadHomeApps() {
|
||||
try {
|
||||
const raw = uni.getStorageSync(STORAGE_KEY)
|
||||
if (raw) {
|
||||
this.homeApps = raw
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('[appCenter] loadHomeApps error:', e)
|
||||
}
|
||||
},
|
||||
fetchApps() {
|
||||
uni.request({
|
||||
url: 'https://mp.yizhezhe.com/api/mp/apps',
|
||||
data: {
|
||||
isPublished: 1,
|
||||
pageSize: 50
|
||||
},
|
||||
success: (res) => {
|
||||
if (res.data?.code === 200 && res.data?.result?.items) {
|
||||
this.allApps = res.data.result.items
|
||||
} else if (res.data?.status === 200 && res.data?.data) {
|
||||
this.allApps = res.data.data
|
||||
} else {
|
||||
return
|
||||
}
|
||||
this.autoFillHomeApps()
|
||||
},
|
||||
fail: () => {
|
||||
this.allApps = []
|
||||
}
|
||||
})
|
||||
},
|
||||
// 自动填充首页展示应用
|
||||
autoFillHomeApps() {
|
||||
const ids = this.homeApps.appIds || []
|
||||
const currentCount = ids.length
|
||||
if (currentCount >= MAX_HOME_APPS) return
|
||||
|
||||
const idSet = new Set(ids)
|
||||
// 从推荐应用中筛选尚未选中的
|
||||
const recommended = this.allApps
|
||||
.filter(item => item.isRecommended && !idSet.has(item.id))
|
||||
|
||||
if (!recommended.length) return
|
||||
|
||||
const slots = MAX_HOME_APPS - currentCount
|
||||
const toAdd = recommended.slice(0, slots).map(item => item.id)
|
||||
|
||||
this.homeApps.appIds = [...ids, ...toAdd]
|
||||
try {
|
||||
uni.setStorageSync(STORAGE_KEY, this.homeApps)
|
||||
} catch (e) {
|
||||
console.error('[appCenter] autoFill save error:', e)
|
||||
}
|
||||
},
|
||||
onAppTap(item) {
|
||||
if (item._isMore) {
|
||||
// 点击"更多"跳转到我的页面
|
||||
uni.switchTab({
|
||||
url: '/pages/user/index'
|
||||
})
|
||||
return
|
||||
}
|
||||
if (!item.url) return
|
||||
this.$util.JumpPath(item.url)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.list-menu {
|
||||
display: grid;
|
||||
grid-template-rows: auto;
|
||||
grid-row-gap: 24rpx;
|
||||
width: 100%;
|
||||
padding: 20rpx 0;
|
||||
box-sizing: border-box;
|
||||
|
||||
.item {
|
||||
text-align: center;
|
||||
|
||||
.img-box {
|
||||
width: 90rpx;
|
||||
height: 90rpx;
|
||||
margin: 0 auto 6rpx;
|
||||
|
||||
image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.empty-box {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: #f3f9ff;
|
||||
}
|
||||
}
|
||||
|
||||
// 更多图标
|
||||
.more-icon-inner {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: #f5f5f5;
|
||||
border-radius: 16rpx;
|
||||
|
||||
.more-dots {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 6rpx;
|
||||
|
||||
.more-dot {
|
||||
width: 8rpx;
|
||||
height: 8rpx;
|
||||
border-radius: 50%;
|
||||
background: #bbb;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,250 +1,250 @@
|
||||
<template>
|
||||
<!-- 图片组件 -->
|
||||
<view v-show="!dataConfig.isHide" class="images-component" :style="containerStyle">
|
||||
<!-- 无链接时使用普通view -->
|
||||
<view v-if="!linkUrl" class="images-navigator" :style="imgContainerStyle">
|
||||
<image
|
||||
v-if="imgUrl"
|
||||
:src="imgUrl"
|
||||
:mode="imgMode"
|
||||
class="images-img"
|
||||
:style="imgStyle"
|
||||
:show-menu-by-longpress="isQrCode"
|
||||
@load="onImgLoad"
|
||||
@error="onImgError"
|
||||
></image>
|
||||
<!-- 占位图 -->
|
||||
<view v-else class="images-placeholder">
|
||||
<text class="placeholder-text">暂无图片</text>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 有链接时使用navigator -->
|
||||
<navigator v-else :url="linkUrl" hover-class="none" class="images-navigator" :style="imgContainerStyle">
|
||||
<image
|
||||
v-if="imgUrl"
|
||||
:src="imgUrl"
|
||||
:mode="imgMode"
|
||||
class="images-img"
|
||||
:style="imgStyle"
|
||||
:show-menu-by-longpress="isQrCode"
|
||||
@load="onImgLoad"
|
||||
@error="onImgError"
|
||||
></image>
|
||||
<!-- 占位图 -->
|
||||
<view v-else class="images-placeholder">
|
||||
<text class="placeholder-text">暂无图片</text>
|
||||
</view>
|
||||
</navigator>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'home_image',
|
||||
props: {
|
||||
dataConfig: {
|
||||
type: Object,
|
||||
default: () => {}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
imgError: false
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
const debug = uni.getStorageSync('DEBUG_DIY_RENDER') === true
|
||||
if (!debug) return
|
||||
console.log('[DIY][component]', 'home_image', 'mounted', {
|
||||
id: this.dataConfig?.id,
|
||||
timestamp: this.dataConfig?.timestamp,
|
||||
url: this.imgConfig?.url || this.dataConfig?.imgConfig?.url
|
||||
})
|
||||
},
|
||||
computed: {
|
||||
// 图片配置
|
||||
imgConfig() {
|
||||
return this.dataConfig.imgConfig || {}
|
||||
},
|
||||
// 链接配置
|
||||
linkConfig() {
|
||||
return this.dataConfig.linkConfig || {}
|
||||
},
|
||||
// 二维码模式
|
||||
isQrCode() {
|
||||
return this.dataConfig.isQrCode?.val === true
|
||||
},
|
||||
// 上边距
|
||||
topConfig() {
|
||||
return this.dataConfig.topConfig || {}
|
||||
},
|
||||
// 下边距
|
||||
bottomConfig() {
|
||||
return this.dataConfig.bottomConfig || {}
|
||||
},
|
||||
// 左右边距
|
||||
prConfig() {
|
||||
return this.dataConfig.prConfig || {}
|
||||
},
|
||||
// 页面间距
|
||||
mbConfig() {
|
||||
return this.dataConfig.mbConfig || {}
|
||||
},
|
||||
// 圆角配置
|
||||
fillet() {
|
||||
return this.dataConfig.fillet || {}
|
||||
},
|
||||
// 背景颜色
|
||||
bgColor() {
|
||||
return this.dataConfig.bgColor || {}
|
||||
},
|
||||
// 图片地址
|
||||
imgUrl() {
|
||||
const url = this.imgConfig.url || ''
|
||||
if (!url) return ''
|
||||
// 处理安全域名
|
||||
if (url.indexOf('https://') > -1) return url
|
||||
return url.replace('http://', 'https://')
|
||||
},
|
||||
// 链接地址(从 imgConfig.link 获取)
|
||||
linkUrl() {
|
||||
// 直接从 imgConfig.link 获取字符串链接
|
||||
const link = this.imgConfig.link || this.linkConfig?.link || ''
|
||||
if (!link) return ''
|
||||
// 支持字符串链接
|
||||
if (typeof link === 'string') {
|
||||
return link
|
||||
}
|
||||
// 支持对象结构 { url: '', title: '' }
|
||||
if (typeof link === 'object') {
|
||||
return link.url || ''
|
||||
}
|
||||
// 兼容旧的数组结构
|
||||
if (Array.isArray(link) && link.length > 0) {
|
||||
return link[0]?.link || link[0]?.url || ''
|
||||
}
|
||||
return ''
|
||||
},
|
||||
// 图片显示模式
|
||||
imgMode() {
|
||||
return 'widthFix'
|
||||
},
|
||||
// 容器样式
|
||||
containerStyle() {
|
||||
const style = {}
|
||||
|
||||
// 上边距
|
||||
if (this.topConfig.val) {
|
||||
style.marginTop = this.topConfig.val + 'rpx'
|
||||
}
|
||||
|
||||
// 页面间距
|
||||
if (this.mbConfig.val) {
|
||||
style.marginBottom = this.mbConfig.val + 'rpx'
|
||||
}
|
||||
|
||||
// 下边距
|
||||
if (this.bottomConfig.val) {
|
||||
style.paddingBottom = this.bottomConfig.val + 'rpx'
|
||||
}
|
||||
|
||||
// 背景颜色
|
||||
if (this.bgColor.color && this.bgColor.color[0]?.item) {
|
||||
style.backgroundColor = this.bgColor.color[0].item
|
||||
}
|
||||
|
||||
return style
|
||||
},
|
||||
// 图片容器样式
|
||||
imgContainerStyle() {
|
||||
const style = {}
|
||||
const fillet = this.fillet
|
||||
|
||||
// 左右边距
|
||||
if (this.prConfig.val) {
|
||||
style.paddingLeft = this.prConfig.val + 'rpx'
|
||||
style.paddingRight = this.prConfig.val + 'rpx'
|
||||
}
|
||||
|
||||
// 圆角 - 全部圆角模式
|
||||
if (fillet.type === 0 && fillet.val) {
|
||||
style.borderRadius = fillet.val + 'rpx'
|
||||
}
|
||||
|
||||
return style
|
||||
},
|
||||
// 图片样式
|
||||
imgStyle() {
|
||||
const style = {}
|
||||
const fillet = this.fillet
|
||||
|
||||
// 圆角 - 单独设置模式
|
||||
if (fillet.type === 1 && fillet.valList) {
|
||||
const [tl, tr, br, bl] = fillet.valList
|
||||
const radius = `${tl?.val || 0}rpx ${tr?.val || 0}rpx ${br?.val || 0}rpx ${bl?.val || 0}rpx`
|
||||
style.borderRadius = radius
|
||||
}
|
||||
|
||||
return style
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onImgLoad(e) {
|
||||
const debug = uni.getStorageSync('DEBUG_DIY_RENDER') === true
|
||||
if (!debug) return
|
||||
console.log('[DIY][component]', 'home_image', 'img_load', {
|
||||
id: this.dataConfig?.id,
|
||||
timestamp: this.dataConfig?.timestamp,
|
||||
src: this.imgUrl,
|
||||
width: e?.detail?.width,
|
||||
height: e?.detail?.height
|
||||
})
|
||||
},
|
||||
// 图片加载失败处理
|
||||
onImgError(e) {
|
||||
const debug = uni.getStorageSync('DEBUG_DIY_RENDER') === true
|
||||
if (debug) {
|
||||
console.log('[DIY][component]', 'home_image', 'img_error', {
|
||||
id: this.dataConfig?.id,
|
||||
timestamp: this.dataConfig?.timestamp,
|
||||
src: this.imgUrl,
|
||||
detail: e?.detail
|
||||
})
|
||||
}
|
||||
this.imgError = true
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.images-component {
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
overflow: hidden;
|
||||
|
||||
.images-navigator {
|
||||
display: block;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.images-img {
|
||||
width: 100%;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.images-placeholder {
|
||||
width: 100%;
|
||||
height: 300rpx;
|
||||
background-color: #f5f5f5;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
.placeholder-text {
|
||||
color: #999;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<template>
|
||||
<!-- 图片组件 -->
|
||||
<view v-show="!dataConfig.isHide" class="images-component" :style="containerStyle">
|
||||
<!-- 无链接时使用普通view -->
|
||||
<view v-if="!linkUrl" class="images-navigator" :style="imgContainerStyle">
|
||||
<image
|
||||
v-if="imgUrl"
|
||||
:src="imgUrl"
|
||||
:mode="imgMode"
|
||||
class="images-img"
|
||||
:style="imgStyle"
|
||||
:show-menu-by-longpress="isQrCode"
|
||||
@load="onImgLoad"
|
||||
@error="onImgError"
|
||||
></image>
|
||||
<!-- 占位图 -->
|
||||
<view v-else class="images-placeholder">
|
||||
<text class="placeholder-text">暂无图片</text>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 有链接时使用navigator -->
|
||||
<navigator v-else :url="linkUrl" hover-class="none" class="images-navigator" :style="imgContainerStyle">
|
||||
<image
|
||||
v-if="imgUrl"
|
||||
:src="imgUrl"
|
||||
:mode="imgMode"
|
||||
class="images-img"
|
||||
:style="imgStyle"
|
||||
:show-menu-by-longpress="isQrCode"
|
||||
@load="onImgLoad"
|
||||
@error="onImgError"
|
||||
></image>
|
||||
<!-- 占位图 -->
|
||||
<view v-else class="images-placeholder">
|
||||
<text class="placeholder-text">暂无图片</text>
|
||||
</view>
|
||||
</navigator>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'home_image',
|
||||
props: {
|
||||
dataConfig: {
|
||||
type: Object,
|
||||
default: () => {}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
imgError: false
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
const debug = uni.getStorageSync('DEBUG_DIY_RENDER') === true
|
||||
if (!debug) return
|
||||
console.log('[DIY][component]', 'home_image', 'mounted', {
|
||||
id: this.dataConfig?.id,
|
||||
timestamp: this.dataConfig?.timestamp,
|
||||
url: this.imgConfig?.url || this.dataConfig?.imgConfig?.url
|
||||
})
|
||||
},
|
||||
computed: {
|
||||
// 图片配置
|
||||
imgConfig() {
|
||||
return this.dataConfig.imgConfig || {}
|
||||
},
|
||||
// 链接配置
|
||||
linkConfig() {
|
||||
return this.dataConfig.linkConfig || {}
|
||||
},
|
||||
// 二维码模式
|
||||
isQrCode() {
|
||||
return this.dataConfig.isQrCode?.val === true
|
||||
},
|
||||
// 上边距
|
||||
topConfig() {
|
||||
return this.dataConfig.topConfig || {}
|
||||
},
|
||||
// 下边距
|
||||
bottomConfig() {
|
||||
return this.dataConfig.bottomConfig || {}
|
||||
},
|
||||
// 左右边距
|
||||
prConfig() {
|
||||
return this.dataConfig.prConfig || {}
|
||||
},
|
||||
// 页面间距
|
||||
mbConfig() {
|
||||
return this.dataConfig.mbConfig || {}
|
||||
},
|
||||
// 圆角配置
|
||||
fillet() {
|
||||
return this.dataConfig.fillet || {}
|
||||
},
|
||||
// 背景颜色
|
||||
bgColor() {
|
||||
return this.dataConfig.bgColor || {}
|
||||
},
|
||||
// 图片地址
|
||||
imgUrl() {
|
||||
const url = this.imgConfig.url || ''
|
||||
if (!url) return ''
|
||||
// 处理安全域名
|
||||
if (url.indexOf('https://') > -1) return url
|
||||
return url.replace('http://', 'https://')
|
||||
},
|
||||
// 链接地址(从 imgConfig.link 获取)
|
||||
linkUrl() {
|
||||
// 直接从 imgConfig.link 获取字符串链接
|
||||
const link = this.imgConfig.link || this.linkConfig?.link || ''
|
||||
if (!link) return ''
|
||||
// 支持字符串链接
|
||||
if (typeof link === 'string') {
|
||||
return link
|
||||
}
|
||||
// 支持对象结构 { url: '', title: '' }
|
||||
if (typeof link === 'object') {
|
||||
return link.url || ''
|
||||
}
|
||||
// 兼容旧的数组结构
|
||||
if (Array.isArray(link) && link.length > 0) {
|
||||
return link[0]?.link || link[0]?.url || ''
|
||||
}
|
||||
return ''
|
||||
},
|
||||
// 图片显示模式
|
||||
imgMode() {
|
||||
return 'widthFix'
|
||||
},
|
||||
// 容器样式
|
||||
containerStyle() {
|
||||
const style = {}
|
||||
|
||||
// 上边距
|
||||
if (this.topConfig.val) {
|
||||
style.marginTop = this.topConfig.val + 'rpx'
|
||||
}
|
||||
|
||||
// 页面间距
|
||||
if (this.mbConfig.val) {
|
||||
style.marginBottom = this.mbConfig.val + 'rpx'
|
||||
}
|
||||
|
||||
// 下边距
|
||||
if (this.bottomConfig.val) {
|
||||
style.paddingBottom = this.bottomConfig.val + 'rpx'
|
||||
}
|
||||
|
||||
// 背景颜色
|
||||
if (this.bgColor.color && this.bgColor.color[0]?.item) {
|
||||
style.backgroundColor = this.bgColor.color[0].item
|
||||
}
|
||||
|
||||
return style
|
||||
},
|
||||
// 图片容器样式
|
||||
imgContainerStyle() {
|
||||
const style = {}
|
||||
const fillet = this.fillet
|
||||
|
||||
// 左右边距
|
||||
if (this.prConfig.val) {
|
||||
style.paddingLeft = this.prConfig.val + 'rpx'
|
||||
style.paddingRight = this.prConfig.val + 'rpx'
|
||||
}
|
||||
|
||||
// 圆角 - 全部圆角模式
|
||||
if (fillet.type === 0 && fillet.val) {
|
||||
style.borderRadius = fillet.val + 'rpx'
|
||||
}
|
||||
|
||||
return style
|
||||
},
|
||||
// 图片样式
|
||||
imgStyle() {
|
||||
const style = {}
|
||||
const fillet = this.fillet
|
||||
|
||||
// 圆角 - 单独设置模式
|
||||
if (fillet.type === 1 && fillet.valList) {
|
||||
const [tl, tr, br, bl] = fillet.valList
|
||||
const radius = `${tl?.val || 0}rpx ${tr?.val || 0}rpx ${br?.val || 0}rpx ${bl?.val || 0}rpx`
|
||||
style.borderRadius = radius
|
||||
}
|
||||
|
||||
return style
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onImgLoad(e) {
|
||||
const debug = uni.getStorageSync('DEBUG_DIY_RENDER') === true
|
||||
if (!debug) return
|
||||
console.log('[DIY][component]', 'home_image', 'img_load', {
|
||||
id: this.dataConfig?.id,
|
||||
timestamp: this.dataConfig?.timestamp,
|
||||
src: this.imgUrl,
|
||||
width: e?.detail?.width,
|
||||
height: e?.detail?.height
|
||||
})
|
||||
},
|
||||
// 图片加载失败处理
|
||||
onImgError(e) {
|
||||
const debug = uni.getStorageSync('DEBUG_DIY_RENDER') === true
|
||||
if (debug) {
|
||||
console.log('[DIY][component]', 'home_image', 'img_error', {
|
||||
id: this.dataConfig?.id,
|
||||
timestamp: this.dataConfig?.timestamp,
|
||||
src: this.imgUrl,
|
||||
detail: e?.detail
|
||||
})
|
||||
}
|
||||
this.imgError = true
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.images-component {
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
overflow: hidden;
|
||||
|
||||
.images-navigator {
|
||||
display: block;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.images-img {
|
||||
width: 100%;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.images-placeholder {
|
||||
width: 100%;
|
||||
height: 300rpx;
|
||||
background-color: #f5f5f5;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
.placeholder-text {
|
||||
color: #999;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,216 +1,216 @@
|
||||
<template>
|
||||
<view v-show="!isHidden" class="page-title-wrap" :style="wrapStyleStr">
|
||||
<view class="page-title-box px-20" :style="pageTitleBoxStyleStr">
|
||||
<view class="nav-inner" :style="navInnerStyleStr">
|
||||
<view class="side" :style="leftSideStyleStr" @tap="onBack">
|
||||
<text class="iconfont icon-ic_leftarrow" :style="iconStyleStr"></text>
|
||||
</view>
|
||||
<view class="title" :style="titleStyleStr">{{ titleText }}</view>
|
||||
<view class="side" :style="rightSideStyleStr"></view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'pageTopbar',
|
||||
props: {
|
||||
dataConfig: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
__statusBarRpx: 0,
|
||||
__statusBarPx: 0,
|
||||
__rpx2px: 0.5,
|
||||
__navHeightPx: 44
|
||||
}
|
||||
},
|
||||
created() {
|
||||
try {
|
||||
const info = uni.getWindowInfo ? uni.getWindowInfo() : uni.getSystemInfoSync()
|
||||
const statusBarPx = Number(info?.statusBarHeight || 0)
|
||||
const windowWidthPx = Number(info?.windowWidth || 375)
|
||||
this.__statusBarPx = statusBarPx
|
||||
this.__rpx2px = windowWidthPx ? windowWidthPx / 750 : 0.5
|
||||
this.__navHeightPx = 80 * this.__rpx2px
|
||||
this.__statusBarRpx = windowWidthPx ? (statusBarPx * 750) / windowWidthPx : 0
|
||||
} catch (e) {
|
||||
this.__statusBarPx = 0
|
||||
this.__rpx2px = 0.5
|
||||
this.__navHeightPx = 44
|
||||
this.__statusBarRpx = 0
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
const debug = uni.getStorageSync('DEBUG_DIY_RENDER') === true
|
||||
if (!debug) return
|
||||
console.log('[DIY][component]', 'pageTopbar', 'mounted', {
|
||||
id: this.dataConfig?.id,
|
||||
timestamp: this.dataConfig?.timestamp,
|
||||
title: this.dataConfig?.titleConfig?.value,
|
||||
statusBarRpx: this.__statusBarRpx,
|
||||
statusBarPx: this.__statusBarPx,
|
||||
rpx2px: this.__rpx2px,
|
||||
navHeightPx: this.__navHeightPx,
|
||||
sideWidthPx: this.sideWidthPx
|
||||
})
|
||||
this.$nextTick(() => {
|
||||
try {
|
||||
uni.createSelectorQuery()
|
||||
.in(this)
|
||||
.select('.page-title-wrap')
|
||||
.boundingClientRect(rect => {
|
||||
console.log('[DIY][component]', 'pageTopbar', 'rect', rect)
|
||||
})
|
||||
.select('.page-title-box')
|
||||
.boundingClientRect(rect => {
|
||||
console.log('[DIY][component]', 'pageTopbar', 'rect_box', rect)
|
||||
})
|
||||
.select('.nav-inner')
|
||||
.boundingClientRect(rect => {
|
||||
console.log('[DIY][component]', 'pageTopbar', 'rect_inner', rect)
|
||||
})
|
||||
.exec()
|
||||
} catch (e) {}
|
||||
})
|
||||
},
|
||||
computed: {
|
||||
isHidden() {
|
||||
return this.dataConfig?.isHide === true || this.dataConfig?.isHide === '1'
|
||||
},
|
||||
titleText() {
|
||||
return this.dataConfig?.titleConfig?.value || ''
|
||||
},
|
||||
linkValue() {
|
||||
return this.dataConfig?.linkConfig?.value || ''
|
||||
},
|
||||
themeColorValue() {
|
||||
return this.dataConfig?.themeColor?.color?.[0]?.item || '#282828'
|
||||
},
|
||||
titleColorValue() {
|
||||
return this.dataConfig?.titleColor?.color?.[0]?.item || '#282828'
|
||||
},
|
||||
bgColorValue() {
|
||||
return this.dataConfig?.bgColor?.color?.[0]?.item || '#ffffff'
|
||||
},
|
||||
fontSizeVal() {
|
||||
return Number(this.dataConfig?.fontSize?.val ?? 16)
|
||||
},
|
||||
iconSizeVal() {
|
||||
return Number(this.dataConfig?.iconSize?.val ?? 18)
|
||||
},
|
||||
navHeightRpx() {
|
||||
return 80
|
||||
},
|
||||
topVal() {
|
||||
return Number(this.dataConfig?.topConfig?.val ?? 0)
|
||||
},
|
||||
bottomVal() {
|
||||
return Number(this.dataConfig?.bottomConfig?.val ?? 0)
|
||||
},
|
||||
prVal() {
|
||||
return Number(this.dataConfig?.prConfig?.val ?? 0)
|
||||
},
|
||||
mbVal() {
|
||||
return Number(this.dataConfig?.mbConfig?.val ?? 0)
|
||||
},
|
||||
fillet() {
|
||||
return this.dataConfig?.fillet || {}
|
||||
},
|
||||
wrapStyleStr() {
|
||||
const top = this.topVal * 2
|
||||
const padTop = Math.max(0, Number(top))
|
||||
return `background:#f5f5f5;margin-top:${this.mbVal * 2}rpx;padding-top:${padTop}rpx;padding-bottom:${this.bottomVal * 2}rpx;padding-left:${this.prVal * 2}rpx;padding-right:${this.prVal * 2}rpx;`
|
||||
},
|
||||
pageTitleBoxStyleStr() {
|
||||
const base = `width:100%;display:flex;align-items:center;padding-top:${this.__statusBarPx}px;box-sizing:border-box;`
|
||||
const bg = `background:${this.bgColorValue};`
|
||||
let radius = ''
|
||||
if (this.fillet.type === 0 && this.fillet.val !== undefined) {
|
||||
radius = `border-radius:${Number(this.fillet.val) * 2}rpx;`
|
||||
}
|
||||
if (this.fillet.type === 1 && Array.isArray(this.fillet.valList)) {
|
||||
const [tl, tr, br, bl] = this.fillet.valList
|
||||
radius = `border-radius:${Number(tl?.val || 0) * 2}rpx ${Number(tr?.val || 0) * 2}rpx ${Number(br?.val || 0) * 2}rpx ${Number(bl?.val || 0) * 2}rpx;`
|
||||
}
|
||||
return base + bg + radius
|
||||
},
|
||||
navInnerStyleStr() {
|
||||
return `width:100%;display:flex;align-items:center;height:${this.__navHeightPx}px;box-sizing:border-box;`
|
||||
},
|
||||
leftSideStyleStr() {
|
||||
return `width:${this.sideWidthPx}px;height:100%;display:flex;align-items:center;justify-content:flex-start;`
|
||||
},
|
||||
rightSideStyleStr() {
|
||||
return `width:${this.sideWidthPx}px;height:100%;display:flex;align-items:center;justify-content:flex-end;`
|
||||
},
|
||||
iconStyleStr() {
|
||||
return `font-size:${this.iconSizeVal * 2}rpx;color:${this.themeColorValue};font-weight:bold;`
|
||||
},
|
||||
titleStyleStr() {
|
||||
return `font-size:${this.fontSizeVal * 2}rpx;color:${this.titleColorValue};flex:1;font-weight:bold;text-align:center;line-height:${this.__navHeightPx}px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;`
|
||||
},
|
||||
sideWidthRpx() {
|
||||
return Math.max(80, this.iconSizeVal * 2 + 28)
|
||||
},
|
||||
sideWidth() {
|
||||
return `${this.sideWidthRpx}rpx`
|
||||
},
|
||||
sideWidthPx() {
|
||||
return this.sideWidthRpx * (this.__rpx2px || 0.5)
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onBack() {
|
||||
const url = this.linkValue
|
||||
if (!url) return
|
||||
const pure = url.split('?')[0]
|
||||
const tabPages = [
|
||||
'/pages/index/index',
|
||||
'/pages/goods_cate/goods_cate',
|
||||
'/pages/discoverIndex/index',
|
||||
'/pages/order_addcart/order_addcart',
|
||||
'/pages/user/index'
|
||||
]
|
||||
if (tabPages.includes(pure)) {
|
||||
uni.switchTab({ url })
|
||||
return
|
||||
}
|
||||
uni.navigateTo({ url })
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.page-title-wrap {
|
||||
width: 100%;
|
||||
}
|
||||
.page-title-box {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
.nav-inner {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
.side {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-start;
|
||||
}
|
||||
.title {
|
||||
flex: 1;
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
</style>
|
||||
<template>
|
||||
<view v-show="!isHidden" class="page-title-wrap" :style="wrapStyleStr">
|
||||
<view class="page-title-box px-20" :style="pageTitleBoxStyleStr">
|
||||
<view class="nav-inner" :style="navInnerStyleStr">
|
||||
<view class="side" :style="leftSideStyleStr" @tap="onBack">
|
||||
<text class="iconfont icon-ic_leftarrow" :style="iconStyleStr"></text>
|
||||
</view>
|
||||
<view class="title" :style="titleStyleStr">{{ titleText }}</view>
|
||||
<view class="side" :style="rightSideStyleStr"></view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'pageTopbar',
|
||||
props: {
|
||||
dataConfig: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
__statusBarRpx: 0,
|
||||
__statusBarPx: 0,
|
||||
__rpx2px: 0.5,
|
||||
__navHeightPx: 44
|
||||
}
|
||||
},
|
||||
created() {
|
||||
try {
|
||||
const info = uni.getWindowInfo ? uni.getWindowInfo() : uni.getSystemInfoSync()
|
||||
const statusBarPx = Number(info?.statusBarHeight || 0)
|
||||
const windowWidthPx = Number(info?.windowWidth || 375)
|
||||
this.__statusBarPx = statusBarPx
|
||||
this.__rpx2px = windowWidthPx ? windowWidthPx / 750 : 0.5
|
||||
this.__navHeightPx = 80 * this.__rpx2px
|
||||
this.__statusBarRpx = windowWidthPx ? (statusBarPx * 750) / windowWidthPx : 0
|
||||
} catch (e) {
|
||||
this.__statusBarPx = 0
|
||||
this.__rpx2px = 0.5
|
||||
this.__navHeightPx = 44
|
||||
this.__statusBarRpx = 0
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
const debug = uni.getStorageSync('DEBUG_DIY_RENDER') === true
|
||||
if (!debug) return
|
||||
console.log('[DIY][component]', 'pageTopbar', 'mounted', {
|
||||
id: this.dataConfig?.id,
|
||||
timestamp: this.dataConfig?.timestamp,
|
||||
title: this.dataConfig?.titleConfig?.value,
|
||||
statusBarRpx: this.__statusBarRpx,
|
||||
statusBarPx: this.__statusBarPx,
|
||||
rpx2px: this.__rpx2px,
|
||||
navHeightPx: this.__navHeightPx,
|
||||
sideWidthPx: this.sideWidthPx
|
||||
})
|
||||
this.$nextTick(() => {
|
||||
try {
|
||||
uni.createSelectorQuery()
|
||||
.in(this)
|
||||
.select('.page-title-wrap')
|
||||
.boundingClientRect(rect => {
|
||||
console.log('[DIY][component]', 'pageTopbar', 'rect', rect)
|
||||
})
|
||||
.select('.page-title-box')
|
||||
.boundingClientRect(rect => {
|
||||
console.log('[DIY][component]', 'pageTopbar', 'rect_box', rect)
|
||||
})
|
||||
.select('.nav-inner')
|
||||
.boundingClientRect(rect => {
|
||||
console.log('[DIY][component]', 'pageTopbar', 'rect_inner', rect)
|
||||
})
|
||||
.exec()
|
||||
} catch (e) {}
|
||||
})
|
||||
},
|
||||
computed: {
|
||||
isHidden() {
|
||||
return this.dataConfig?.isHide === true || this.dataConfig?.isHide === '1'
|
||||
},
|
||||
titleText() {
|
||||
return this.dataConfig?.titleConfig?.value || ''
|
||||
},
|
||||
linkValue() {
|
||||
return this.dataConfig?.linkConfig?.value || ''
|
||||
},
|
||||
themeColorValue() {
|
||||
return this.dataConfig?.themeColor?.color?.[0]?.item || '#282828'
|
||||
},
|
||||
titleColorValue() {
|
||||
return this.dataConfig?.titleColor?.color?.[0]?.item || '#282828'
|
||||
},
|
||||
bgColorValue() {
|
||||
return this.dataConfig?.bgColor?.color?.[0]?.item || '#ffffff'
|
||||
},
|
||||
fontSizeVal() {
|
||||
return Number(this.dataConfig?.fontSize?.val ?? 16)
|
||||
},
|
||||
iconSizeVal() {
|
||||
return Number(this.dataConfig?.iconSize?.val ?? 18)
|
||||
},
|
||||
navHeightRpx() {
|
||||
return 80
|
||||
},
|
||||
topVal() {
|
||||
return Number(this.dataConfig?.topConfig?.val ?? 0)
|
||||
},
|
||||
bottomVal() {
|
||||
return Number(this.dataConfig?.bottomConfig?.val ?? 0)
|
||||
},
|
||||
prVal() {
|
||||
return Number(this.dataConfig?.prConfig?.val ?? 0)
|
||||
},
|
||||
mbVal() {
|
||||
return Number(this.dataConfig?.mbConfig?.val ?? 0)
|
||||
},
|
||||
fillet() {
|
||||
return this.dataConfig?.fillet || {}
|
||||
},
|
||||
wrapStyleStr() {
|
||||
const top = this.topVal * 2
|
||||
const padTop = Math.max(0, Number(top))
|
||||
return `background:#f5f5f5;margin-top:${this.mbVal * 2}rpx;padding-top:${padTop}rpx;padding-bottom:${this.bottomVal * 2}rpx;padding-left:${this.prVal * 2}rpx;padding-right:${this.prVal * 2}rpx;`
|
||||
},
|
||||
pageTitleBoxStyleStr() {
|
||||
const base = `width:100%;display:flex;align-items:center;padding-top:${this.__statusBarPx}px;box-sizing:border-box;`
|
||||
const bg = `background:${this.bgColorValue};`
|
||||
let radius = ''
|
||||
if (this.fillet.type === 0 && this.fillet.val !== undefined) {
|
||||
radius = `border-radius:${Number(this.fillet.val) * 2}rpx;`
|
||||
}
|
||||
if (this.fillet.type === 1 && Array.isArray(this.fillet.valList)) {
|
||||
const [tl, tr, br, bl] = this.fillet.valList
|
||||
radius = `border-radius:${Number(tl?.val || 0) * 2}rpx ${Number(tr?.val || 0) * 2}rpx ${Number(br?.val || 0) * 2}rpx ${Number(bl?.val || 0) * 2}rpx;`
|
||||
}
|
||||
return base + bg + radius
|
||||
},
|
||||
navInnerStyleStr() {
|
||||
return `width:100%;display:flex;align-items:center;height:${this.__navHeightPx}px;box-sizing:border-box;`
|
||||
},
|
||||
leftSideStyleStr() {
|
||||
return `width:${this.sideWidthPx}px;height:100%;display:flex;align-items:center;justify-content:flex-start;`
|
||||
},
|
||||
rightSideStyleStr() {
|
||||
return `width:${this.sideWidthPx}px;height:100%;display:flex;align-items:center;justify-content:flex-end;`
|
||||
},
|
||||
iconStyleStr() {
|
||||
return `font-size:${this.iconSizeVal * 2}rpx;color:${this.themeColorValue};font-weight:bold;`
|
||||
},
|
||||
titleStyleStr() {
|
||||
return `font-size:${this.fontSizeVal * 2}rpx;color:${this.titleColorValue};flex:1;font-weight:bold;text-align:center;line-height:${this.__navHeightPx}px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;`
|
||||
},
|
||||
sideWidthRpx() {
|
||||
return Math.max(80, this.iconSizeVal * 2 + 28)
|
||||
},
|
||||
sideWidth() {
|
||||
return `${this.sideWidthRpx}rpx`
|
||||
},
|
||||
sideWidthPx() {
|
||||
return this.sideWidthRpx * (this.__rpx2px || 0.5)
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onBack() {
|
||||
const url = this.linkValue
|
||||
if (!url) return
|
||||
const pure = url.split('?')[0]
|
||||
const tabPages = [
|
||||
'/pages/index/index',
|
||||
'/pages/goods_cate/goods_cate',
|
||||
'/pages/discoverIndex/index',
|
||||
'/pages/order_addcart/order_addcart',
|
||||
'/pages/user/index'
|
||||
]
|
||||
if (tabPages.includes(pure)) {
|
||||
uni.switchTab({ url })
|
||||
return
|
||||
}
|
||||
uni.navigateTo({ url })
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.page-title-wrap {
|
||||
width: 100%;
|
||||
}
|
||||
.page-title-box {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
.nav-inner {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
.side {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-start;
|
||||
}
|
||||
.title {
|
||||
flex: 1;
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,102 +1,102 @@
|
||||
<template>
|
||||
<!-- 富文本 -->
|
||||
<view v-if="!dataConfig.isHide" :style="[richTextWrapStyle]">
|
||||
<view class="richText" v-if="description" :style="[richTextStyle]">
|
||||
<!-- #ifdef MP-WEIXIN -->
|
||||
<!-- <rich-text :nodes="description"></rich-text> -->
|
||||
<jyf-parser :html="description" :tag-style="tagStyle" ref="article"></jyf-parser>
|
||||
<!-- #endif -->
|
||||
<!-- #ifdef H5 || APP-PLUS -->
|
||||
<view v-html="description"></view>
|
||||
<!-- #endif -->
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
||||
<script>
|
||||
import parser from '@/components/jyf-parser/jyf-parser';
|
||||
export default {
|
||||
name: 'richText',
|
||||
props: {
|
||||
dataConfig: {
|
||||
type: Object,
|
||||
default: () => {}
|
||||
},
|
||||
isSortType: {
|
||||
type: String | Number,
|
||||
default: 0
|
||||
}
|
||||
},
|
||||
components: { 'jyf-parser': parser },
|
||||
data() {
|
||||
return {
|
||||
bgColor: '',
|
||||
lrConfig: 0,
|
||||
udConfig: 0,
|
||||
tagStyle: {
|
||||
img: 'width:100%;display:block;',
|
||||
table: 'width:100%',
|
||||
video: 'width:100%;float:left;'
|
||||
},
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
description() {
|
||||
let description = this.dataConfig.richText.val;
|
||||
if (description) {
|
||||
description = description.replace(
|
||||
/<img/gi,
|
||||
'<img style="max-width:100%;height:auto;float:left;display:block" '
|
||||
);
|
||||
description = description.replace(
|
||||
/<video/gi,
|
||||
'<video style="width:100%;height:auto;display:block" '
|
||||
);
|
||||
}
|
||||
return description;
|
||||
},
|
||||
richTextStyle() {
|
||||
let borderRadius = `${this.dataConfig.fillet.val * 2}rpx`;
|
||||
if (this.dataConfig.fillet.type) {
|
||||
borderRadius =
|
||||
`${this.dataConfig.fillet.valList[0].val * 2}rpx ${this.dataConfig.fillet.valList[1].val * 2}rpx ${this.dataConfig.fillet.valList[2].val * 2}rpx ${this.dataConfig.fillet.valList[3].val * 2}rpx`;
|
||||
}
|
||||
return {
|
||||
'border-radius': borderRadius,
|
||||
'background': this.dataConfig.bgColor.color[0].item,
|
||||
};
|
||||
},
|
||||
richTextWrapStyle() {
|
||||
return {
|
||||
'padding': `${this.dataConfig.topConfig.val * 2}rpx ${this.dataConfig.lrConfig.val * 2}rpx ${this.dataConfig.bottomConfig.val * 2}rpx`,
|
||||
'margin-top': `${this.dataConfig.udConfig.val * 2}rpx`,
|
||||
'background': this.dataConfig.bottomBgColor.color[0].item,
|
||||
};
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.richText {
|
||||
padding: 30rpx;
|
||||
background-color: #fff;
|
||||
|
||||
// margin: 0 20rpx;
|
||||
// border-radius: 24rpx;
|
||||
&::after {
|
||||
content: "";
|
||||
display: table;
|
||||
clear: both;
|
||||
}
|
||||
}
|
||||
|
||||
/deep/uni-video {
|
||||
width: 100% !important;
|
||||
}
|
||||
|
||||
/deep/video {
|
||||
width: 100% !important;
|
||||
}
|
||||
<template>
|
||||
<!-- 富文本 -->
|
||||
<view v-if="!dataConfig.isHide" :style="[richTextWrapStyle]">
|
||||
<view class="richText" v-if="description" :style="[richTextStyle]">
|
||||
<!-- #ifdef MP-WEIXIN -->
|
||||
<!-- <rich-text :nodes="description"></rich-text> -->
|
||||
<jyf-parser :html="description" :tag-style="tagStyle" ref="article"></jyf-parser>
|
||||
<!-- #endif -->
|
||||
<!-- #ifdef H5 || APP-PLUS -->
|
||||
<view v-html="description"></view>
|
||||
<!-- #endif -->
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
||||
<script>
|
||||
import parser from '@/components/jyf-parser/jyf-parser';
|
||||
export default {
|
||||
name: 'richText',
|
||||
props: {
|
||||
dataConfig: {
|
||||
type: Object,
|
||||
default: () => {}
|
||||
},
|
||||
isSortType: {
|
||||
type: String | Number,
|
||||
default: 0
|
||||
}
|
||||
},
|
||||
components: { 'jyf-parser': parser },
|
||||
data() {
|
||||
return {
|
||||
bgColor: '',
|
||||
lrConfig: 0,
|
||||
udConfig: 0,
|
||||
tagStyle: {
|
||||
img: 'width:100%;display:block;',
|
||||
table: 'width:100%',
|
||||
video: 'width:100%;float:left;'
|
||||
},
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
description() {
|
||||
let description = this.dataConfig.richText.val;
|
||||
if (description) {
|
||||
description = description.replace(
|
||||
/<img/gi,
|
||||
'<img style="max-width:100%;height:auto;float:left;display:block" '
|
||||
);
|
||||
description = description.replace(
|
||||
/<video/gi,
|
||||
'<video style="width:100%;height:auto;display:block" '
|
||||
);
|
||||
}
|
||||
return description;
|
||||
},
|
||||
richTextStyle() {
|
||||
let borderRadius = `${this.dataConfig.fillet.val * 2}rpx`;
|
||||
if (this.dataConfig.fillet.type) {
|
||||
borderRadius =
|
||||
`${this.dataConfig.fillet.valList[0].val * 2}rpx ${this.dataConfig.fillet.valList[1].val * 2}rpx ${this.dataConfig.fillet.valList[2].val * 2}rpx ${this.dataConfig.fillet.valList[3].val * 2}rpx`;
|
||||
}
|
||||
return {
|
||||
'border-radius': borderRadius,
|
||||
'background': this.dataConfig.bgColor.color[0].item,
|
||||
};
|
||||
},
|
||||
richTextWrapStyle() {
|
||||
return {
|
||||
'padding': `${this.dataConfig.topConfig.val * 2}rpx ${this.dataConfig.lrConfig.val * 2}rpx ${this.dataConfig.bottomConfig.val * 2}rpx`,
|
||||
'margin-top': `${this.dataConfig.udConfig.val * 2}rpx`,
|
||||
'background': this.dataConfig.bottomBgColor.color[0].item,
|
||||
};
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.richText {
|
||||
padding: 30rpx;
|
||||
background-color: #fff;
|
||||
|
||||
// margin: 0 20rpx;
|
||||
// border-radius: 24rpx;
|
||||
&::after {
|
||||
content: "";
|
||||
display: table;
|
||||
clear: both;
|
||||
}
|
||||
}
|
||||
|
||||
/deep/uni-video {
|
||||
width: 100% !important;
|
||||
}
|
||||
|
||||
/deep/video {
|
||||
width: 100% !important;
|
||||
}
|
||||
</style>
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -73,14 +73,14 @@ export default {
|
||||
</view>
|
||||
</view>
|
||||
<!-- 余额、优惠券 -->
|
||||
<view class="acea-row balance-coupon">
|
||||
<!-- <view class="acea-row balance-coupon">
|
||||
<view class="item" v-for="(item, index) in property" @tap="goMenuPage(item.url)" :key="index">
|
||||
<view class="value num-fa-semi">{{ item.value || 0 }}</view>
|
||||
<view>{{ item.label }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view> -->
|
||||
<!-- 会员中心、积分商城 -->
|
||||
<view class="acea-row member-points">
|
||||
<!-- <view class="acea-row member-points">
|
||||
<view class="acea-row row-middle row-center item" @tap="intoPage(userInfo.level_status == 1 ? '/pages/users/user_vip/index' : '/pages/annex/vip_grade_active/index')">
|
||||
<view>
|
||||
<view>会员中心</view>
|
||||
@@ -101,7 +101,7 @@ export default {
|
||||
</view>
|
||||
<image src="@/static/images/user-points.png" class="image"></image>
|
||||
</view>
|
||||
</view>
|
||||
</view> -->
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
||||
435
pages/user/components/myApps/index.vue
Normal file
435
pages/user/components/myApps/index.vue
Normal file
@@ -0,0 +1,435 @@
|
||||
<template>
|
||||
<view class="my-apps-wrap">
|
||||
<!-- 展示模式 -->
|
||||
<template v-if="!editing">
|
||||
<!-- 顶部:标题 + 编辑按钮 -->
|
||||
<view class="pt-34 pr-30 pb-20 pl-32 bg--w111-fff rd-t-16rpx mt-20 service ml-20 mr-20">
|
||||
<view class="flex-row-between">
|
||||
<view class="fs-30 fw-500 lh-42rpx text--w111-333">我的应用</view>
|
||||
<view class="edit-btn" @click="enterEdit">
|
||||
<text class="fs-24 text--w111-1890ff">编辑首页应用</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 应用列表 -->
|
||||
<view class="pt-10 pr-30 pb-32 pl-32 bg--w111-fff rd-b-16rpx service ml-20 mr-20" v-if="allApps.length">
|
||||
<view class="grid-column-4 grid-gap-x-76rpx grid-gap-y-54rpx">
|
||||
<view v-for="(item, index) in allApps" :key="index">
|
||||
<view class="flex-col flex-center" @click="onAppTap(item)">
|
||||
<image :src="item.logo" class="app-icon rd-16rpx" v-if="item.logo"></image>
|
||||
<view class="empty-box" v-else></view>
|
||||
<text class="fs-26 lh-36rpx text--w111-282828 pt-22">{{ item.name }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<!-- 编辑模式 -->
|
||||
<template v-else>
|
||||
<!-- 编辑卡片:整合头栏 + 首页展示栏 + 全部应用 -->
|
||||
<view class="bg--w111-fff rd-16rpx mt-20 ml-20 mr-20">
|
||||
<!-- 顶部操作栏 -->
|
||||
<view class="edit-header">
|
||||
<view class="edit-header-inner">
|
||||
<view class="header-btn btn-cancel" @click="cancelEdit">取消</view>
|
||||
<view class="fs-30 fw-500 text--w111-333">编辑首页展示</view>
|
||||
<view class="header-btn btn-save" @click="saveEdit">保存</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 首页展示栏(横向滚动) -->
|
||||
<view class="home-bar-wrap" v-if="editSelectedIds.length">
|
||||
<view class="home-bar-label fs-28 text--w111-333">首页展示栏</view>
|
||||
<scroll-view class="home-bar-scroll" scroll-x enhanced show-scrollbar="false">
|
||||
<view class="home-bar-inner">
|
||||
<view
|
||||
class="home-bar-item"
|
||||
v-for="(item, index) in editSelectedList"
|
||||
:key="item.id"
|
||||
>
|
||||
<view class="home-bar-icon-wrap">
|
||||
<image :src="item.logo" class="home-bar-icon rd-16rpx" v-if="item.logo"></image>
|
||||
<view class="empty-box-sm" v-else></view>
|
||||
<!-- 删除标记 -->
|
||||
<view class="badge badge-remove" @click="removeFromHome(item.id)">✕</view>
|
||||
</view>
|
||||
<text class="home-bar-name">{{ item.name }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
|
||||
<!-- 全部应用列表 -->
|
||||
<view class="all-apps-list">
|
||||
<view class="fs-28 text--w111-333 mb-20">全部应用</view>
|
||||
<view class="grid-column-4 grid-gap-x-76rpx grid-gap-y-54rpx">
|
||||
<view v-for="(item, index) in allApps" :key="index">
|
||||
<view
|
||||
class="flex-col flex-center pos-relative"
|
||||
@click="toggleAppSelect(item)"
|
||||
>
|
||||
<view class="app-icon-wrap">
|
||||
<image :src="item.logo" class="app-icon rd-16rpx" v-if="item.logo"></image>
|
||||
<view class="empty-box" v-else></view>
|
||||
<!-- 已选遮罩 -->
|
||||
<view class="selected-overlay" v-if="isSelected(item.id)">
|
||||
<text class="selected-check">✓</text>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 添加标记(未选中时) -->
|
||||
<view
|
||||
class="badge badge-add"
|
||||
v-if="!isSelected(item.id) && editSelectedIds.length < 6"
|
||||
@click.stop="addToHome(item)"
|
||||
>+</view>
|
||||
<text
|
||||
class="fs-26 lh-36rpx pt-22"
|
||||
:class="isSelected(item.id) ? 'text--w111-ccc' : 'text--w111-282828'"
|
||||
>{{ item.name }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
const STORAGE_KEY = 'MY_HOME_APPS'
|
||||
const MAX_HOME_APPS = 6
|
||||
|
||||
export default {
|
||||
name: 'userMyApps',
|
||||
data() {
|
||||
return {
|
||||
allApps: [],
|
||||
// Storage 数据
|
||||
homeApps: {
|
||||
showOnHome: true,
|
||||
appIds: []
|
||||
},
|
||||
editing: false,
|
||||
// 编辑中的临时副本
|
||||
editAppIds: []
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
editSelectedIds() {
|
||||
return this.editAppIds
|
||||
},
|
||||
// 编辑模式中已选应用的完整对象列表(按 allApps 顺序排列)
|
||||
editSelectedList() {
|
||||
const idSet = new Set(this.editAppIds)
|
||||
const filtered = this.allApps.filter(item => idSet.has(item.id))
|
||||
const indexMap = new Map(this.allApps.map((item, i) => [item.id, i]))
|
||||
filtered.sort((a, b) => (indexMap.get(a.id) ?? 999) - (indexMap.get(b.id) ?? 999))
|
||||
return filtered
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.loadData()
|
||||
this.fetchApps()
|
||||
},
|
||||
// 从首页"更多"跳转过来时刷新数据
|
||||
onShow() {
|
||||
this.loadData()
|
||||
},
|
||||
methods: {
|
||||
// ---------- 数据层 ----------
|
||||
loadData() {
|
||||
try {
|
||||
const raw = uni.getStorageSync(STORAGE_KEY)
|
||||
if (raw) {
|
||||
this.homeApps = raw
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('[myApps] loadData error:', e)
|
||||
}
|
||||
},
|
||||
saveData() {
|
||||
try {
|
||||
uni.setStorageSync(STORAGE_KEY, this.homeApps)
|
||||
} catch (e) {
|
||||
console.error('[myApps] saveData error:', e)
|
||||
}
|
||||
},
|
||||
fetchApps() {
|
||||
uni.request({
|
||||
url: 'https://mp.yizhezhe.com/api/mp/apps',
|
||||
data: {
|
||||
isPublished: 1,
|
||||
pageSize: 50
|
||||
},
|
||||
success: (res) => {
|
||||
if (res.data?.code === 200 && res.data?.result?.items) {
|
||||
this.allApps = res.data.result.items
|
||||
} else if (res.data?.status === 200 && res.data?.data) {
|
||||
this.allApps = res.data.data
|
||||
} else {
|
||||
return
|
||||
}
|
||||
this.autoFillHomeApps()
|
||||
},
|
||||
fail: () => {
|
||||
this.allApps = []
|
||||
}
|
||||
})
|
||||
},
|
||||
// 自动填充首页展示应用(与 appCenter 逻辑一致)
|
||||
autoFillHomeApps() {
|
||||
const ids = this.homeApps.appIds || []
|
||||
const currentCount = ids.length
|
||||
if (currentCount >= 6) return
|
||||
|
||||
const idSet = new Set(ids)
|
||||
const recommended = this.allApps
|
||||
.filter(item => item.isRecommended && !idSet.has(item.id))
|
||||
|
||||
if (!recommended.length) return
|
||||
|
||||
const slots = 6 - currentCount
|
||||
const toAdd = recommended.slice(0, slots).map(item => item.id)
|
||||
|
||||
this.homeApps.appIds = [...ids, ...toAdd]
|
||||
this.saveData()
|
||||
},
|
||||
|
||||
// ---------- 展示模式 ----------
|
||||
onAppTap(item) {
|
||||
if (!item.url) return
|
||||
this.$util.JumpPath(item.url)
|
||||
},
|
||||
|
||||
// ---------- 编辑模式 ----------
|
||||
enterEdit() {
|
||||
// 复制当前 appIds 作为编辑副本
|
||||
this.editAppIds = [...(this.homeApps.appIds || [])]
|
||||
this.editing = true
|
||||
},
|
||||
cancelEdit() {
|
||||
this.editing = false
|
||||
this.editAppIds = []
|
||||
},
|
||||
saveEdit() {
|
||||
this.homeApps.appIds = [...this.editAppIds]
|
||||
this.saveData()
|
||||
this.editing = false
|
||||
},
|
||||
// 判断应用是否已选
|
||||
isSelected(id) {
|
||||
return this.editAppIds.includes(id)
|
||||
},
|
||||
// 添加到首页栏(从全部应用点击+)
|
||||
addToHome(item) {
|
||||
if (this.editAppIds.length >= MAX_HOME_APPS) {
|
||||
uni.showToast({ title: `最多选择${MAX_HOME_APPS}个应用`, icon: 'none' })
|
||||
return
|
||||
}
|
||||
if (!this.editAppIds.includes(item.id)) {
|
||||
this.editAppIds.push(item.id)
|
||||
}
|
||||
},
|
||||
// 从首页栏移除(点击✕)
|
||||
removeFromHome(id) {
|
||||
this.editAppIds = this.editAppIds.filter(i => i !== id)
|
||||
},
|
||||
// 点击应用图标切换选中状态
|
||||
toggleAppSelect(item) {
|
||||
if (this.isSelected(item.id)) {
|
||||
this.removeFromHome(item.id)
|
||||
} else {
|
||||
this.addToHome(item)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.my-apps-wrap {
|
||||
// 左右布局
|
||||
.flex-row-between {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
// 应用图标(展示模式 + 编辑模式通用)
|
||||
.app-icon {
|
||||
width: 96rpx;
|
||||
height: 96rpx;
|
||||
}
|
||||
.empty-box {
|
||||
width: 96rpx;
|
||||
height: 96rpx;
|
||||
background-color: #f3f9ff;
|
||||
border-radius: 8rpx;
|
||||
}
|
||||
|
||||
.app-icon-wrap {
|
||||
position: relative;
|
||||
width: 96rpx;
|
||||
height: 96rpx;
|
||||
}
|
||||
|
||||
// 编辑按钮
|
||||
.edit-btn {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
padding: 6rpx 20rpx;
|
||||
border: 2rpx solid #1890ff;
|
||||
border-radius: 10rpx;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
// ---------- 编辑模式 ----------
|
||||
.edit-header {
|
||||
padding: 24rpx 30rpx 0;
|
||||
|
||||
.edit-header-inner {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.header-btn {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: 56rpx;
|
||||
padding: 0 28rpx;
|
||||
border-radius: 28rpx;
|
||||
font-size: 26rpx;
|
||||
font-weight: 500;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.btn-cancel {
|
||||
color: #666;
|
||||
background: #f5f5f5;
|
||||
}
|
||||
|
||||
.btn-save {
|
||||
color: #fff;
|
||||
background: linear-gradient(135deg, #1890ff, #096dd9);
|
||||
box-shadow: 0 4rpx 12rpx rgba(24, 144, 255, 0.35);
|
||||
}
|
||||
}
|
||||
|
||||
// 首页展示栏
|
||||
.home-bar-wrap {
|
||||
padding: 24rpx 30rpx 0;
|
||||
margin-top: 20rpx;
|
||||
|
||||
.home-bar-label {
|
||||
margin-bottom: 16rpx;
|
||||
}
|
||||
|
||||
.home-bar-scroll {
|
||||
white-space: nowrap;
|
||||
overflow: visible !important;
|
||||
|
||||
.home-bar-inner {
|
||||
display: flex;
|
||||
gap: 24rpx;
|
||||
|
||||
.home-bar-item {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
flex-shrink: 0;
|
||||
width: 100rpx;
|
||||
padding-top: 12rpx;
|
||||
|
||||
.home-bar-icon-wrap {
|
||||
position: relative;
|
||||
width: 90rpx;
|
||||
height: 90rpx;
|
||||
overflow: visible;
|
||||
|
||||
.home-bar-icon {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 16rpx;
|
||||
}
|
||||
|
||||
.empty-box-sm {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: #f3f9ff;
|
||||
border-radius: 16rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.home-bar-name {
|
||||
font-size: 22rpx;
|
||||
color: #333;
|
||||
margin-top: 8rpx;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
max-width: 100rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 全部应用列表
|
||||
.all-apps-list {
|
||||
padding: 30rpx 30rpx 34rpx;
|
||||
}
|
||||
|
||||
// ---------- 通用徽标 ----------
|
||||
.badge {
|
||||
position: absolute;
|
||||
width: 36rpx;
|
||||
height: 36rpx;
|
||||
border-radius: 50%;
|
||||
font-size: 20rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: #fff;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.badge-remove {
|
||||
top: -8rpx;
|
||||
right: -8rpx;
|
||||
background: #ff4d4f;
|
||||
}
|
||||
|
||||
.badge-add {
|
||||
top: -8rpx;
|
||||
right: 6rpx;
|
||||
background: #52c41a;
|
||||
}
|
||||
|
||||
.selected-overlay {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: rgba(0, 0, 0, 0.35);
|
||||
border-radius: 8rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
z-index: 1;
|
||||
|
||||
.selected-check {
|
||||
color: #fff;
|
||||
font-size: 28rpx;
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
|
||||
.pos-relative {
|
||||
position: relative;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -351,9 +351,16 @@
|
||||
this.isShow = false
|
||||
},
|
||||
back() {
|
||||
uni.navigateBack({
|
||||
delta: this.configData.wechat_auth_switch ? 2 : 1
|
||||
})
|
||||
const pages = getCurrentPages();
|
||||
if (pages.length > 1) {
|
||||
uni.navigateBack({
|
||||
delta: this.configData.wechat_auth_switch ? 2 : 1
|
||||
})
|
||||
} else {
|
||||
uni.switchTab({
|
||||
url: '/pages/index/index'
|
||||
});
|
||||
}
|
||||
},
|
||||
privacy(type) {
|
||||
uni.navigateTo({
|
||||
|
||||
@@ -149,6 +149,16 @@ export default {
|
||||
</view>
|
||||
</navigator>
|
||||
</view>
|
||||
<!-- #ifdef MP -->
|
||||
<view class="list rd-24rpx mx-20">
|
||||
<view class="item acea-row row-between-wrapper" @click="outLogin">
|
||||
<view>退出登录</view>
|
||||
<view class="grab">
|
||||
<text class="iconfont icon-ic_rightarrow"></text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- #endif -->
|
||||
<!-- #ifdef H5 -->
|
||||
<view class="log-out list rd-24rpx mx-20 acea-row row-center-wrapper" @click="outLogin" v-if="!this.$wechat.isWeixin()">退出登录</view>
|
||||
<!-- #endif -->
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -24,19 +24,23 @@
|
||||
<view class="wechat-login">
|
||||
<view class="btn-wrapper">
|
||||
<!-- #ifdef H5 -->
|
||||
<button hover-class="none" @tap="wechatLogin" class="bg-color btn1">授权登录</button>
|
||||
<button hover-class="none" @tap="handleAuthBtnTap" class="bg-color btn1">授权登录</button>
|
||||
<!-- #endif -->
|
||||
<!-- #ifdef MP -->
|
||||
<template v-if="configData.wechat_auth_switch">
|
||||
<button hover-class="none" v-if="bindPhone" open-type="getPhoneNumber" @getphonenumber="getphonenumber"
|
||||
<button hover-class="none" v-if="bindPhone && protocol" open-type="getPhoneNumber" @getphonenumber="getphonenumber"
|
||||
class="bg-color btn1">授权登录</button>
|
||||
<button hover-class="none" v-else-if="!bindPhone" @tap="getAuthLogin"
|
||||
<button hover-class="none" v-else-if="bindPhone && !protocol" @tap="handleAuthBtnTap"
|
||||
class="bg-color btn1">授权登录</button>
|
||||
<button hover-class="none" v-else-if="mp_is_new" @tap="userLogin"
|
||||
<button hover-class="none" v-else-if="!bindPhone" @tap="handleAuthBtnTap"
|
||||
class="bg-color btn1">授权登录</button>
|
||||
<button v-else-if="canUseGetUserProfile && code" hover-class="none" @tap="getUserProfile"
|
||||
class="bg-color btn1">授权登录</button>
|
||||
<button v-else hover-class="none" open-type="getUserInfo" @getuserinfo="setUserInfo"
|
||||
<button hover-class="none" v-else-if="mp_is_new" @tap="onAuthorizeLoginTap('mp_userLogin')"
|
||||
class="bg-color btn1">授权登录</button>
|
||||
<button v-else-if="canUseGetUserProfile && code" hover-class="none" @tap="onAuthorizeLoginTap('mp_userProfile')"
|
||||
class="bg-color btn1">授权登录</button>
|
||||
<button v-else-if="protocol" hover-class="none" open-type="getUserInfo" @getuserinfo="setUserInfo"
|
||||
class="bg-color btn1">授权登录</button>
|
||||
<button v-else hover-class="none" @tap="onAuthorizeLoginTap('mp_userinfo')"
|
||||
class="bg-color btn1">授权登录</button>
|
||||
</template>
|
||||
<button v-if="configData.phone_auth_switch" hover-class="none" @tap="phoneLogin" class="btn2">手机号登录</button>
|
||||
@@ -67,6 +71,23 @@
|
||||
<privacyAgreementPopup v-if="canGetPrivacySetting" @onReject="onReject" @onAgree="onAgree">
|
||||
</privacyAgreementPopup>
|
||||
<!-- #endif -->
|
||||
|
||||
<view v-if="showProtocolDialog" class="protocol-modal">
|
||||
<view class="protocol-modal__mask" @tap="rejectProtocol"></view>
|
||||
<view class="protocol-modal__box">
|
||||
<view class="protocol-modal__title">用户协议与隐私协议</view>
|
||||
<view class="protocol-modal__content">
|
||||
<text>已阅读并同意</text>
|
||||
<text class="font-num" @tap.stop="privacy('user')">《用户协议》</text>
|
||||
<text>与</text>
|
||||
<text class="font-num" @tap.stop="privacy('privacy')">《隐私协议》</text>
|
||||
</view>
|
||||
<view class="protocol-modal__actions">
|
||||
<view class="protocol-modal__btn" @tap="rejectProtocol">不同意</view>
|
||||
<view class="protocol-modal__btn protocol-modal__btn--primary bg-color" @tap="agreeProtocol">同意并继续</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@@ -123,6 +144,8 @@
|
||||
protocol: false,
|
||||
bindPhone: false,
|
||||
isShow: false,
|
||||
showProtocolDialog: false,
|
||||
pendingAuthorizeAction: '',
|
||||
};
|
||||
},
|
||||
components: {
|
||||
@@ -169,8 +192,62 @@
|
||||
uni.removeStorageSync('form_type_cart');
|
||||
},
|
||||
methods: {
|
||||
handleAuthBtnTap() {
|
||||
let action = '';
|
||||
// #ifdef H5
|
||||
action = 'h5_wechat';
|
||||
// #endif
|
||||
// #ifdef MP
|
||||
action = this.bindPhone ? 'mp_phone' : 'mp_auth';
|
||||
// #endif
|
||||
this.openProtocolDialog(action);
|
||||
},
|
||||
onAuthorizeLoginTap(action) {
|
||||
this.openProtocolDialog(action);
|
||||
},
|
||||
openProtocolDialog(action) {
|
||||
this.pendingAuthorizeAction = action || '';
|
||||
this.showProtocolDialog = true;
|
||||
},
|
||||
agreeProtocol() {
|
||||
const action = this.pendingAuthorizeAction;
|
||||
this.pendingAuthorizeAction = '';
|
||||
this.showProtocolDialog = false;
|
||||
this.protocol = true;
|
||||
this.$nextTick(() => {
|
||||
this.runAuthorizeAction(action, {
|
||||
afterAgree: true
|
||||
});
|
||||
});
|
||||
},
|
||||
rejectProtocol() {
|
||||
this.pendingAuthorizeAction = '';
|
||||
this.showProtocolDialog = false;
|
||||
},
|
||||
runAuthorizeAction(action, options = {}) {
|
||||
if (!action) return;
|
||||
if (action === 'h5_wechat') return this.wechatLogin();
|
||||
if (action === 'mp_auth') return this.getAuthLogin();
|
||||
if (action === 'mp_userLogin') return this.userLogin();
|
||||
if (action === 'mp_userProfile') return this.getUserProfile();
|
||||
if (action === 'mp_phone' || action === 'mp_userinfo') {
|
||||
if (options.afterAgree) {
|
||||
return this.$util.Tips({
|
||||
title: '请点击授权登录继续'
|
||||
});
|
||||
}
|
||||
return;
|
||||
}
|
||||
},
|
||||
cancelLogin(){
|
||||
uni.navigateBack()
|
||||
const pages = getCurrentPages();
|
||||
if (pages.length > 1) {
|
||||
uni.navigateBack();
|
||||
} else {
|
||||
uni.switchTab({
|
||||
url: '/pages/index/index'
|
||||
});
|
||||
}
|
||||
},
|
||||
wechatAuthLogin(d, back_url) {
|
||||
let that = this;
|
||||
@@ -286,10 +363,24 @@
|
||||
this.protocol = true
|
||||
},
|
||||
onReject() {
|
||||
uni.navigateBack();
|
||||
const pages = getCurrentPages();
|
||||
if (pages.length > 1) {
|
||||
uni.navigateBack();
|
||||
} else {
|
||||
uni.switchTab({
|
||||
url: '/pages/index/index'
|
||||
});
|
||||
}
|
||||
},
|
||||
back() {
|
||||
uni.navigateBack();
|
||||
const pages = getCurrentPages();
|
||||
if (pages.length > 1) {
|
||||
uni.navigateBack();
|
||||
} else {
|
||||
uni.switchTab({
|
||||
url: '/pages/index/index'
|
||||
});
|
||||
}
|
||||
},
|
||||
home() {
|
||||
uni.switchTab({
|
||||
@@ -531,7 +622,7 @@
|
||||
},
|
||||
// 公众号登录
|
||||
wechatLogin() {
|
||||
if (!this.protocol && this.configData.store_user_agreement) {
|
||||
if (!this.protocol) {
|
||||
return this.$util.Tips({
|
||||
title: '请先阅读并同意协议'
|
||||
});
|
||||
@@ -690,4 +781,69 @@
|
||||
height: 40rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.protocol-modal {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
z-index: 20000;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.protocol-modal__mask {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background: rgba(0, 0, 0, 0.55);
|
||||
}
|
||||
|
||||
.protocol-modal__box {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
width: 620rpx;
|
||||
background: #fff;
|
||||
border-radius: 24rpx;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.protocol-modal__title {
|
||||
padding: 40rpx 40rpx 0;
|
||||
font-size: 32rpx;
|
||||
font-weight: 500;
|
||||
color: #333333;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.protocol-modal__content {
|
||||
padding: 32rpx 40rpx 40rpx;
|
||||
font-size: 28rpx;
|
||||
color: #333333;
|
||||
line-height: 42rpx;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.protocol-modal__actions {
|
||||
display: flex;
|
||||
border-top: 1px solid #EEEEEE;
|
||||
}
|
||||
|
||||
.protocol-modal__btn {
|
||||
flex: 1;
|
||||
height: 88rpx;
|
||||
line-height: 88rpx;
|
||||
text-align: center;
|
||||
font-size: 30rpx;
|
||||
color: #666666;
|
||||
}
|
||||
|
||||
.protocol-modal__btn--primary {
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user