Compare commits
33 Commits
xindeznkf
...
custom/com
| Author | SHA1 | Date | |
|---|---|---|---|
| 23c954981b | |||
| aa2f13f3b2 | |||
| 09c49365a3 | |||
| 40c1d27f02 | |||
| ae5577c0ee | |||
| 04d045e81e | |||
| 30fef9770a | |||
| 3f666a5e83 | |||
| 94c9d1c556 | |||
| 3acd3870b6 | |||
| bec0a51d81 | |||
| d744e1c16d | |||
| 6a1bf3b5bc | |||
| 526de0d73f | |||
| dcf3703892 | |||
| 6894950b7e | |||
| 781bb8845e | |||
| b70725c104 | |||
| 8dce1058f6 | |||
| 6b6c50ebb8 | |||
| b079487c9a | |||
| ef7b609efb | |||
| 7a28bb7f7a | |||
| 921e8b79b1 | |||
| 0101c36012 | |||
| 469bc4da81 | |||
| 50072c45ab | |||
| c790d63005 | |||
| 71c866c0f8 | |||
| a5740f53af | |||
| 8f0a13c473 | |||
| 6d0c914e79 | |||
| 3fec0470cf |
@@ -145,7 +145,7 @@ export default {
|
||||
if (isJump && route != 'pages/index/index') {
|
||||
uni.setStorageSync('manual_change_store', true); // 手动切换门店
|
||||
this.$store.dispatch('getCartNumber'); //重新获取购物车数据
|
||||
this.$util.redirectTo('/pages/index/index');
|
||||
this.$util.redirectTo(this.$util.INDEX_PAGE_URL);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -240,7 +240,7 @@ export default {
|
||||
},
|
||||
goHome() {
|
||||
if (this.preview) return; // 开启预览,禁止任何操作和跳转
|
||||
this.$util.redirectTo('/pages/index/index');
|
||||
this.$util.redirectTo(this.$util.INDEX_PAGE_URL);
|
||||
},
|
||||
goCart() {
|
||||
if (this.preview) return; // 开启预览,禁止任何操作和跳转
|
||||
|
||||
@@ -66,15 +66,16 @@ export default {
|
||||
|
||||
const locale = uni.getStorageSync('lang') || "zh-cn"; //设置语言
|
||||
|
||||
var value = '';
|
||||
let value = ''; // 存放解析后的语言值
|
||||
let langPath = ''; // 存放当前页面语言包路径
|
||||
|
||||
try {
|
||||
//公共语言包(同步加载)
|
||||
var lang = loadLangPackSync(locale, 'common');
|
||||
|
||||
//当前页面语言包(同步加载)
|
||||
let route = _this.route;
|
||||
let langPath = processRoutePath(route);
|
||||
console.log(`当前语言: ${locale}, 当前页面语言包路径: ${langPath}`);
|
||||
langPath = processRoutePath(route);
|
||||
|
||||
// 加载当前页面语言包
|
||||
let currentPageLang = loadLangPackSync(locale, langPath);
|
||||
@@ -102,7 +103,7 @@ export default {
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
console.error('解析语言包失败:', e);
|
||||
console.error('解析语言包失败:', e, { langPath, field, locale });
|
||||
value = field;
|
||||
}
|
||||
|
||||
@@ -115,7 +116,10 @@ export default {
|
||||
if (value == undefined || (value == 'title' && field == 'title')) value = ''; // field
|
||||
|
||||
// 多语言调试,注释后可以关闭控制台输出
|
||||
console.log(`字段: ${field}, 值: ${value}`)
|
||||
if (field == value) {
|
||||
console.warn(`警告: 字段 ${field} 在语言包 ${langPath} 中未找到对应值,使用默认值 ${field} 当前语言: ${locale}`);
|
||||
}
|
||||
|
||||
return value;
|
||||
},
|
||||
/**
|
||||
|
||||
@@ -61,8 +61,8 @@ export default {
|
||||
groupby_promotion_aux_color: '#F7B500',//活动辅色
|
||||
},
|
||||
...{
|
||||
hover_nav_bg_color: '#FFFC', //背景色: 红色 '#c6251b', 白色: '#FFFC'
|
||||
hover_nav_text_color: '#000' // 文字颜色: 白色 '#FFFFFF', 黑色: '#000'
|
||||
hover_nav_bg_color: '#c6251b', //背景色: 红色 '#c6251b', 白色: '#FFFC'
|
||||
hover_nav_text_color: '#FFFFFF' // 文字颜色: 白色 '#FFFFFF', 黑色: '#000'
|
||||
},
|
||||
},
|
||||
'green': {
|
||||
|
||||
@@ -7,15 +7,19 @@ import {
|
||||
|
||||
|
||||
|
||||
// 首页路径
|
||||
// 关于页面路径,使用常量导出
|
||||
export const INDEX_PAGE_URL = '/pages/index/index';
|
||||
export const CATEGORY_PAGE_URL = '/pages_goods/category';
|
||||
export const CONTACT_PAGE_URL = '/pages_tool/contact/contact';
|
||||
export const MEMBER_PAGE_URL = '/pages_tool/member/index';
|
||||
export const LOGIN_PAGE_URL = '/pages_tool/login/login';
|
||||
|
||||
// 当前最新的tabBar.list (参见pages.json 中的tabBar.list 配置)
|
||||
export const systemTabBarList = [
|
||||
INDEX_PAGE_URL,
|
||||
'/pages_goods/category',
|
||||
'/pages_tool/contact/contact',
|
||||
'/pages_tool/member/index'
|
||||
CATEGORY_PAGE_URL,
|
||||
CONTACT_PAGE_URL,
|
||||
MEMBER_PAGE_URL
|
||||
];
|
||||
|
||||
/**
|
||||
@@ -89,7 +93,7 @@ export const checkTabBarActive = (linkUrl, currentPageRoute) => {
|
||||
const linkUrlParts = adaptSubpackageUrl(linkUrl).split('/');
|
||||
const currentPageRouteParts = currentPageRoute.split('/');
|
||||
|
||||
console.log('diy-bottom-nav verify:', { linkUrlParts, currentPageRouteParts});
|
||||
// console.log('diy-bottom-nav verify:', { linkUrlParts, currentPageRouteParts});
|
||||
|
||||
try {
|
||||
// 二级页面
|
||||
@@ -109,17 +113,24 @@ export const checkTabBarActive = (linkUrl, currentPageRoute) => {
|
||||
}
|
||||
|
||||
export default {
|
||||
/** 导出页面URL常量 */
|
||||
MEMBER_PAGE_URL,
|
||||
CATEGORY_PAGE_URL,
|
||||
CONTACT_PAGE_URL,
|
||||
INDEX_PAGE_URL,
|
||||
LOGIN_PAGE_URL,
|
||||
|
||||
/**
|
||||
* 页面跳转
|
||||
* @param {string} to 跳转链接 /pages/idnex/index
|
||||
* @param {Object} param 参数 {key : value, ...}
|
||||
* @param {string} mode 模式
|
||||
* @param {Object} param 参数 {key : value, ...}, 默认{}
|
||||
* @param {string} mode 模式 navigateTo、redirectTo、reLaunch、tabbar, 默认navigateTo
|
||||
*/
|
||||
redirectTo(to, param, mode) {
|
||||
redirectTo(to, param = {}, mode = 'navigateTo') {
|
||||
let url = to;
|
||||
|
||||
// 替换url中的前缀
|
||||
console.log('redirectTo', to, param, mode);
|
||||
console.log('页面跳转 redirectTo', to, param, mode);
|
||||
url = adaptSubpackageUrl(url);
|
||||
console.log('adaptSubpackageUrl', url);
|
||||
|
||||
@@ -146,26 +157,26 @@ export default {
|
||||
// 如果url不包含tabBarList中的路径,根据mode判断跳转方式
|
||||
switch (mode) {
|
||||
case 'tabbar':
|
||||
// 跳转到 tabBar 页面,并关闭其他所有非 tabBar 页面。
|
||||
// 跳转到 tabBar 页面,并关闭其他所有非 tabBar 页面。重置页面栈,仅保留 tabBar 页面
|
||||
uni.switchTab({
|
||||
url
|
||||
});
|
||||
break;
|
||||
case 'redirectTo':
|
||||
// 关闭当前页面,跳转到应用内的某个页面。
|
||||
// 关闭当前页面,跳转到应用内的某个页面。替换栈顶页面,长度不变(上限10层)
|
||||
uni.redirectTo({
|
||||
url
|
||||
});
|
||||
break;
|
||||
case 'reLaunch':
|
||||
// 关闭所有页面,打开到应用内的某个页面。
|
||||
// 关闭所有页面,打开到应用内的某个页面。清空栈后打开新页面,长度=1
|
||||
uni.reLaunch({
|
||||
url
|
||||
});
|
||||
break;
|
||||
default:
|
||||
// 保留当前页面,跳转到应用内的某个页面
|
||||
console.log('保留当前页面,跳转到应用内的某个页面', url);
|
||||
// 保留当前页面,跳转到应用内的某个页面,新增页面到栈顶,长度+1(上限10层)
|
||||
console.log('保留当前页面,navigateTo跳转到应用内的某个页面', url);
|
||||
uni.navigateTo({
|
||||
url
|
||||
});
|
||||
@@ -592,6 +603,9 @@ export default {
|
||||
}
|
||||
return cloneObj
|
||||
},
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 自定义模板的跳转链接
|
||||
* @param {Object} link
|
||||
@@ -792,7 +806,7 @@ export default {
|
||||
let routes = getCurrentPages(); // 获取当前打开过的页面路由数组
|
||||
return routes.length ? routes[routes.length - 1].route : '';
|
||||
},
|
||||
goBack(backUrl = '/pages/index/index') {
|
||||
goBack(backUrl = INDEX_PAGE_URL) {
|
||||
if (getCurrentPages().length == 1) {
|
||||
this.redirectTo(backUrl);
|
||||
} else {
|
||||
@@ -1148,5 +1162,47 @@ export default {
|
||||
verifyMobile(mobile) {
|
||||
var parse = /^\d{11}$/.test(mobile);
|
||||
return parse;
|
||||
},
|
||||
/**
|
||||
* 判断是否为快应用环境
|
||||
* @returns {boolean} 是否为快应用
|
||||
*/
|
||||
isQuickApp() {
|
||||
// #ifndef QUICKAPP-WEBVIEW
|
||||
let _isQuickApp = false;
|
||||
try {
|
||||
const ua = navigator?.userAgent?.toLowerCase();
|
||||
console.log('ua = ', ua);
|
||||
_isQuickApp = ua.indexOf('quickapp') !== -1;
|
||||
|
||||
if (!_isQuickApp) {
|
||||
// 特殊说明由于网站是嵌入到快应用的Webview组件中<web>,UA中不会包含quickapp字符串,
|
||||
// 但是会包含uniacid参数,所以这里通过uniacid参数来判断是否为快应用环境
|
||||
_isQuickApp = ua.indexOf('uniacid=') !== -1;
|
||||
}
|
||||
} catch (e) {}
|
||||
|
||||
if (!_isQuickApp) {
|
||||
const systemInfo = this.getDeviceInfo();
|
||||
_isQuickApp = systemInfo?.platform === 'quickapp' || process?.env?.UNI_PLATFORM === 'quickapp';
|
||||
}
|
||||
return _isQuickApp;
|
||||
// #endif
|
||||
|
||||
return true;
|
||||
},
|
||||
/**
|
||||
* 判断是否为华为快应用环境
|
||||
* @returns {boolean} 是否为华为快应用
|
||||
*/
|
||||
isHuaweiQuickApp() {
|
||||
if (!this.isQuickApp()) return false;
|
||||
|
||||
// #ifndef QUICKAPP-WEBVIEW-HUAWEI
|
||||
const systemInfo = this.getDeviceInfo();
|
||||
return systemInfo.brand === 'HUAWEI' || systemInfo.manufacturer === 'HUAWEI' ||
|
||||
(typeof qh !== 'undefined' && qh.platform === 'huawei');
|
||||
// #endif
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -145,7 +145,7 @@ export default {
|
||||
let linkUrl = link.wap_url;
|
||||
|
||||
// 首页特殊处理
|
||||
if (linkUrl === '/pages/index/index' && this.name === 'DIY_VIEW_INDEX') {
|
||||
if (linkUrl === this.$util.INDEX_PAGE_URL && this.name === 'DIY_VIEW_INDEX') {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -454,7 +454,7 @@ export default {
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.$refs.login.open('/pages/index/index');
|
||||
this.$refs.login.open(this.$util.INDEX_PAGE_URL);
|
||||
this.couponBtnSwitch = false;
|
||||
}
|
||||
},
|
||||
|
||||
@@ -90,7 +90,7 @@ export default {
|
||||
|
||||
// 页面跳转
|
||||
redirectTo(item) {
|
||||
if (!item.wap_url || this.$util.getCurrRoute() != 'pages/member/index' || this.storeToken) {
|
||||
if (!item.wap_url || this.$util.getCurrRoute() != this.$util.MEMBER_PAGE_URL || this.storeToken) {
|
||||
console.log(item);
|
||||
this.$util.diyRedirectTo(item);
|
||||
} else {
|
||||
|
||||
@@ -75,7 +75,7 @@ export default {
|
||||
this.currentRoute = '/' + currentPage.route;
|
||||
if (!this.storeToken) {
|
||||
this.$util.redirectTo(
|
||||
'/pages_tool/login/login',
|
||||
this.$util.LOGIN_PAGE_URL,
|
||||
{
|
||||
back: this.currentRoute
|
||||
},
|
||||
|
||||
@@ -159,7 +159,7 @@ export default {
|
||||
redirectTo(link) {
|
||||
|
||||
if (link.wap_url) {
|
||||
if (this.$util.getCurrRoute() == 'pages/member/index' && !this.storeToken) {
|
||||
if (this.$util.getCurrRoute() == this.$util.MEMBER_PAGE_URL && !this.storeToken) {
|
||||
this.$refs.login.open(link.wap_url);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -251,6 +251,16 @@
|
||||
<diy-icon :value="item"></diy-icon>
|
||||
</template>
|
||||
|
||||
<template v-if="item.componentName == 'WechatChannel'">
|
||||
<!-- 微信视频号 -->
|
||||
<diy-wechat-channel :value="item"></diy-wechat-channel>
|
||||
</template>
|
||||
|
||||
<template v-if="item.componentName == 'WechatChannelList'">
|
||||
<!-- 微信视频号列表 -->
|
||||
<diy-wechat-channel-list :value="item"></diy-wechat-channel-list>
|
||||
</template>
|
||||
|
||||
<!-- 自定义扩展组件 -->
|
||||
<diy-comp-extend :value="item"></diy-comp-extend>
|
||||
</view>
|
||||
@@ -260,8 +270,8 @@
|
||||
<script>
|
||||
// 组件组展示
|
||||
import DiyMinx from './minx.js'
|
||||
|
||||
export default {
|
||||
components: {},
|
||||
props: {
|
||||
diyData: {
|
||||
type: Object
|
||||
|
||||
@@ -116,7 +116,7 @@ export default {
|
||||
|
||||
// 页面跳转
|
||||
redirectTo(link) {
|
||||
if (!link.wap_url || this.$util.getCurrRoute() != 'pages/member/index' || this.storeToken) {
|
||||
if (!link.wap_url || this.$util.getCurrRoute() != this.$util.MEMBER_PAGE_URL || this.storeToken) {
|
||||
this.$util.diyRedirectTo(link);
|
||||
} else {
|
||||
this.$refs.login.open(link.wap_url);
|
||||
|
||||
@@ -62,8 +62,8 @@ export default {
|
||||
methods: {
|
||||
redirectTo(link) {
|
||||
if (link.wap_url) {
|
||||
if (this.$util.getCurrRoute() == 'pages/member/index' && !this.storeToken) {
|
||||
this.$refs.login.open(link.wap_url);
|
||||
if (this.$util.getCurrRoute() == this.$util.MEMBER_PAGE_URL && !this.storeToken) {
|
||||
this.$refs?.login?.open(link.wap_url);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@
|
||||
@click.stop="modifyInfo()">{{ langIndex == 0 ? 'CN' : 'EN' }}</view>
|
||||
</view>
|
||||
|
||||
<view class="info-wrap" v-else :style="infoStyle" @click="redirect('/pages/member/index')">
|
||||
<view class="info-wrap" v-else :style="infoStyle" @click="redirect($util.MEMBER_PAGE_URL)">
|
||||
<view class="headimg">
|
||||
<image :src="$util.getDefaultImage().head" mode="widthFix"></image>
|
||||
</view>
|
||||
@@ -545,7 +545,7 @@ export default {
|
||||
*/
|
||||
redirectBeforeAuth(url) {
|
||||
if (!this.storeToken) {
|
||||
this.$refs.login.open('/pages/member/index');
|
||||
this.$refs.login.open(this.$util.MEMBER_PAGE_URL);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -583,7 +583,7 @@ export default {
|
||||
url: '/wechat/api/wechat/authcode',
|
||||
data: {
|
||||
scopes: 'snsapi_userinfo',
|
||||
redirect_url: this.$config.h5Domain + '/pages/member/index'
|
||||
redirect_url: this.$config.h5Domain + this.$util.MEMBER_PAGE_URL
|
||||
},
|
||||
success: res => {
|
||||
if (res.code >= 0) {
|
||||
|
||||
@@ -157,7 +157,7 @@ export default {
|
||||
/* 点赞 */
|
||||
giveLike(noteId, index) {
|
||||
if (!this.storeToken) {
|
||||
this.$refs.login.open('/pages/index/index');
|
||||
this.$refs.login.open(this.$util.INDEX_PAGE_URL);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ export default {
|
||||
},
|
||||
redirectTo(link) {
|
||||
if (link.wap_url) {
|
||||
if (this.$util.getCurrRoute() == 'pages/member/index' && !this.storeToken) {
|
||||
if (this.$util.getCurrRoute() == this.$util.MEMBER_PAGE_URL && !this.storeToken) {
|
||||
this.$refs.login.open(link.wap_url);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ export default {
|
||||
methods: {
|
||||
redirectTo(link) {
|
||||
if (link.wap_url) {
|
||||
if (this.$util.getCurrRoute() == 'pages/member/index' && !this.storeToken) {
|
||||
if (this.$util.getCurrRoute() == this.$util.MEMBER_PAGE_URL && !this.storeToken) {
|
||||
this.$refs.login.open(link.wap_url);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -198,7 +198,7 @@ export default {
|
||||
},
|
||||
redirectTo(link) {
|
||||
if (link.wap_url) {
|
||||
if (this.$util.getCurrRoute() == 'pages/member/index' && !this.storeToken) {
|
||||
if (this.$util.getCurrRoute() == this.$util.MEMBER_PAGE_URL && !this.storeToken) {
|
||||
this.$refs.login.open(link.wap_url);
|
||||
return;
|
||||
}
|
||||
|
||||
458
components-diy/diy-wechat-channel-list.vue
Normal file
458
components-diy/diy-wechat-channel-list.vue
Normal file
@@ -0,0 +1,458 @@
|
||||
<template>
|
||||
<view :style="componentStyle">
|
||||
<!-- 固定布局模式 -->
|
||||
<view v-if="value.showStyle == 'fixed'" :class="['channel-list', 'row1-of' + value.rowCount]"
|
||||
style="padding:20rpx;">
|
||||
<view v-for="(item, index) in value.list" :key="index" class="channel-item" @tap="playVideo(item)">
|
||||
<view class="channel-img-wrap">
|
||||
<image class="channel-img" style="border-radius:10rpx;" :src="$util.img(item.coverUrl)"
|
||||
mode="aspectFill" @error="imgError(index)"></image>
|
||||
<view class="channel-play-btn">
|
||||
<image class="play-icon" style="width:30rpx;" :src="$util.img('addon/personnel/shop/view/enterprise/play.png')"
|
||||
mode="widthFix"></image>
|
||||
</view>
|
||||
<view class="channel-stats">
|
||||
<text>{{ item.viewCount }}次观看</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="channel-info-wrap">
|
||||
<view class="channel-name" :style="{
|
||||
'font-size': (value.font.size * 2 + 'rpx') + ';',
|
||||
'font-weight': value.font.weight + ';',
|
||||
'color': value.font.color + ';'
|
||||
}">{{ item.channelName }}</view>
|
||||
<view class="video-title" :style="{
|
||||
'font-size': (value.font.size * 1.8 + 'rpx') + ';',
|
||||
'color': '#666;'
|
||||
}">{{ item.videoTitle }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 其他布局模式 -->
|
||||
<scroll-view v-else :class="['channel-nav', value.showStyle == 'fixed' ? 'fixed-layout' : value.showStyle]"
|
||||
:scroll-x="value.showStyle == 'singleSlide'">
|
||||
<view class="uni-scroll-view-content">
|
||||
<view v-for="(item, index) in value.list" :key="index" :class="['channel-nav-item', value.mode]"
|
||||
:style="{ width: (100 / value.rowCount + '%') + ';' }" @tap="playVideo(item)">
|
||||
<view class="channel-img">
|
||||
<image :style="{
|
||||
'max-width': '100%;',
|
||||
'border-radius': '8rpx;'
|
||||
}" :src="$util.img(item.coverUrl)" mode="aspectFill"
|
||||
:show-menu-by-longpress="true"></image>
|
||||
<view class="channel-play-btn">
|
||||
<image class="play-icon" style="width:30rpx;" :src="$util.img('addon/personnel/shop/view/enterprise/play.png')"
|
||||
mode="widthFix"></image>
|
||||
</view>
|
||||
<view class="channel-stats">
|
||||
<text>{{ item.viewCount }}次观看</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="channel-text" :style="{
|
||||
'margin-left': '16rpx;',
|
||||
'font-size': (value.font.size * 2 + 'rpx') + ';',
|
||||
'font-weight': value.font.weight + ';',
|
||||
'color': value.font.color + ';'
|
||||
}">{{ item.videoTitle }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import DiyMinx from './minx.js'
|
||||
export default {
|
||||
name: 'diy-wechat-channel-list',
|
||||
props: {
|
||||
value: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
}
|
||||
},
|
||||
mixins: [DiyMinx],
|
||||
data() {
|
||||
return {
|
||||
pageWidth: '',
|
||||
indicatorDots: false,
|
||||
swiperCurrent: 0
|
||||
}
|
||||
},
|
||||
created() {
|
||||
// 组件创建时的逻辑
|
||||
},
|
||||
watch: {
|
||||
componentRefresh(newValue) {
|
||||
// 监听组件刷新
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
componentStyle() {
|
||||
let style = '';
|
||||
style += 'background-color:' + this.value.componentBgColor + ';';
|
||||
|
||||
if (this.value.componentAngle == 'round') {
|
||||
style += 'border-top-left-radius:' + (2 * this.value.topAroundRadius) + 'rpx;';
|
||||
style += 'border-top-right-radius:' + (2 * this.value.topAroundRadius) + 'rpx;';
|
||||
style += 'border-bottom-left-radius:' + (2 * this.value.bottomAroundRadius) + 'rpx;';
|
||||
style += 'border-bottom-right-radius:' + (2 * this.value.bottomAroundRadius) + 'rpx;';
|
||||
}
|
||||
|
||||
style += 'box-shadow:' + (this.value.ornament.type == 'shadow' ? '0 0 10rpx ' + this.value.ornament.color : '') + ';';
|
||||
style += 'border:' + (this.value.ornament.type == 'stroke' ? '2rpx solid ' + this.value.ornament.color : '') + ';';
|
||||
|
||||
return style;
|
||||
},
|
||||
|
||||
swiperHeight() {
|
||||
let height = 0;
|
||||
|
||||
if (this.value.mode == 'graphic') {
|
||||
height = (49 + this.value.imageSize) * this.value.pageCount;
|
||||
} else if (this.value.mode == 'img') {
|
||||
height = (22 + this.value.imageSize) * this.value.pageCount;
|
||||
} else if (this.value.mode == 'text') {
|
||||
height = 43 * this.value.pageCount;
|
||||
}
|
||||
|
||||
return 'height:' + (2 * height) + 'rpx';
|
||||
},
|
||||
|
||||
isIndicatorDots() {
|
||||
return this.value.carousel.type != 'hide' &&
|
||||
1 != Math.ceil(this.value.list.length / (this.value.pageCount * this.value.rowCount));
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 播放视频
|
||||
async playVideo(item) {
|
||||
await this.__$emitEvent({
|
||||
eventName: 'video-play', data: item, promiseCallback: (event, handler, awaitedResult) => {
|
||||
if (!awaitedResult) return;
|
||||
// 检查微信环境
|
||||
if (typeof wx === 'undefined') {
|
||||
console.error('当前环境不是微信小程序');
|
||||
return;
|
||||
}
|
||||
// 检查基础库版本
|
||||
const systemInfo = wx.getSystemInfoSync();
|
||||
const SDKVersion = systemInfo.SDKVersion;
|
||||
const versionCompare = (v1, v2) => {
|
||||
const arr1 = v1.split('.');
|
||||
const arr2 = v2.split('.');
|
||||
for (let i = 0; i < Math.max(arr1.length, arr2.length); i++) {
|
||||
const num1 = parseInt(arr1[i] || 0);
|
||||
const num2 = parseInt(arr2[i] || 0);
|
||||
if (num1 > num2) return 1;
|
||||
if (num1 < num2) return -1;
|
||||
}
|
||||
return 0;
|
||||
};
|
||||
if (versionCompare(SDKVersion, '2.19.2') < 0) {
|
||||
console.error('当前微信基础库版本过低,需要 2.19.2 或以上版本');
|
||||
return;
|
||||
}
|
||||
// 调用微信视频号播放API
|
||||
if (wx.openChannelsActivity) {
|
||||
wx.openChannelsActivity({
|
||||
feedId: item.feedId,
|
||||
finderUserName: item.finderUserName,
|
||||
success: (res) => {
|
||||
console.log('打开视频号成功', res);
|
||||
},
|
||||
fail: (err) => {
|
||||
console.error('打开视频号失败', err);
|
||||
// 错误码处理
|
||||
switch (err.errCode) {
|
||||
case 40001:
|
||||
console.error('错误:40001,检查主体要求或嵌入式打开的关联关系');
|
||||
break;
|
||||
case 40002:
|
||||
console.error('错误:40002,参数错误,检查 feedId 和 finderUserName');
|
||||
break;
|
||||
default:
|
||||
console.error('错误:' + err.errCode + ',' + (err.errMsg || '未知错误'));
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
console.error('当前环境不支持微信视频号');
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// 图片加载错误处理
|
||||
imgError(index) {
|
||||
// 图片加载失败的处理逻辑
|
||||
console.log('图片加载失败:', index);
|
||||
// 为失败的图片设置默认图片
|
||||
const item = this.value.list[index];
|
||||
if (item) {
|
||||
// 使用默认图片替代加载失败的图片
|
||||
item.coverUrl = 'addon/personnel/shop/view/enterprise/default-video-cover.png';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.channel-list {
|
||||
&.row1-of3 {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
|
||||
.channel-item {
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
margin-top: 20rpx;
|
||||
width: calc(33.3333333% - 14rpx);
|
||||
box-sizing: border-box;
|
||||
|
||||
&:nth-child(3n + 3) {
|
||||
width: calc(33.33% - 15rpx);
|
||||
}
|
||||
|
||||
&:nth-of-type(1),
|
||||
&:nth-of-type(2),
|
||||
&:nth-of-type(3) {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
&:nth-child(3n) {
|
||||
width: calc(33.3333333% - 15rpx);
|
||||
}
|
||||
|
||||
&:nth-child(3n-1) {
|
||||
margin-left: 20rpx;
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
|
||||
.channel-img-wrap {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
height: 220rpx;
|
||||
border-radius: 10rpx;
|
||||
}
|
||||
|
||||
.channel-img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.channel-play-btn {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
width: 60rpx;
|
||||
height: 60rpx;
|
||||
background-color: rgba(0, 0, 0, 0.4);
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.channel-stats {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
background: linear-gradient(transparent, rgba(0, 0, 0, 0.6));
|
||||
padding: 10rpx;
|
||||
color: #fff;
|
||||
font-size: 20rpx;
|
||||
}
|
||||
|
||||
.channel-info-wrap {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex: 1;
|
||||
padding: 10rpx 0;
|
||||
|
||||
.channel-name {
|
||||
margin-bottom: 4rpx;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.video-title {
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&.row1-of2 {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: space-between;
|
||||
|
||||
.channel-item {
|
||||
position: relative;
|
||||
margin-top: 20rpx;
|
||||
width: calc(50% - 10rpx);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
box-sizing: border-box;
|
||||
|
||||
&:nth-child(2n) {
|
||||
margin-right: 0 !important;
|
||||
}
|
||||
|
||||
&:nth-of-type(1),
|
||||
&:nth-of-type(2) {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.channel-img-wrap {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
height: 340rpx;
|
||||
border-radius: 10rpx;
|
||||
}
|
||||
|
||||
.channel-img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.channel-play-btn {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
width: 80rpx;
|
||||
height: 80rpx;
|
||||
background-color: rgba(0, 0, 0, 0.4);
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.channel-stats {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
background: linear-gradient(transparent, rgba(0, 0, 0, 0.6));
|
||||
padding: 10rpx;
|
||||
color: #fff;
|
||||
font-size: 20rpx;
|
||||
}
|
||||
|
||||
.channel-info-wrap {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex: 1;
|
||||
padding: 10rpx 0;
|
||||
|
||||
.channel-name {
|
||||
margin-bottom: 4rpx;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.video-title {
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.channel-nav {
|
||||
padding: 16rpx;
|
||||
box-sizing: border-box;
|
||||
|
||||
&.fixed-layout {
|
||||
.uni-scroll-view-content {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: space-between;
|
||||
}
|
||||
}
|
||||
|
||||
&.singleSlide {
|
||||
.uni-scroll-view-content {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.channel-nav-item {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.channel-nav-item {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
padding: 14rpx 0;
|
||||
box-sizing: border-box;
|
||||
|
||||
.channel-img {
|
||||
position: relative;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 100%;
|
||||
height: 200rpx;
|
||||
border-radius: 10rpx;
|
||||
overflow: hidden;
|
||||
|
||||
image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.channel-play-btn {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
width: 60rpx;
|
||||
height: 60rpx;
|
||||
background-color: rgba(0, 0, 0, 0.4);
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.channel-stats {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
background: linear-gradient(transparent, rgba(0, 0, 0, 0.6));
|
||||
padding: 10rpx;
|
||||
color: #fff;
|
||||
font-size: 20rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.channel-text {
|
||||
padding-top: 12rpx;
|
||||
line-height: 1.5;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
232
components-diy/diy-wechat-channel.vue
Normal file
232
components-diy/diy-wechat-channel.vue
Normal file
@@ -0,0 +1,232 @@
|
||||
<template>
|
||||
<!-- #ifdef MP-WEIXIN -->
|
||||
<view class="diy-wechat-channel" :style="channelWarpCss">
|
||||
<view class="channel-header" @tap="handlerClick">
|
||||
<image class="channel-avatar" :src="$util.img(value.avatarUrl)" mode="aspectFill"></image>
|
||||
<view class="channel-info">
|
||||
<view class="channel-name">{{ value.channelName }}</view>
|
||||
<view class="channel-follow" v-if="value.showFollow">关注</view>
|
||||
</view>
|
||||
<image class="channel-arrow" :src="$util.img('addon/personnel/shop/view/enterprise/arrow.png')" mode="aspectFill"></image>
|
||||
</view>
|
||||
<!-- 嵌入式视频播放 -->
|
||||
<native-component v-if="value.embedMode && typeof wx !== 'undefined' && wx.canIUse('component.channel-video')">
|
||||
<channel-video
|
||||
:feed-id="value.feedId"
|
||||
:finder-user-name="value.finderUserName"
|
||||
:feed-token="value.feedToken"
|
||||
style="width: 100%; height: 320rpx;">
|
||||
</channel-video>
|
||||
</native-component>
|
||||
<!-- 跳转式视频播放 -->
|
||||
<view v-else class="channel-video" @tap="playVideo">
|
||||
<image class="video-cover" :src="$util.img(value.coverUrl)" mode="aspectFill"></image>
|
||||
<view class="video-play-btn">
|
||||
<image class="play-icon" :src="$util.img('addon/personnel/shop/view/enterprise/play.png')" mode="aspectFill"></image>
|
||||
</view>
|
||||
<view class="video-info">
|
||||
<view class="video-title">{{ value.videoTitle }}</view>
|
||||
<view class="video-stats">
|
||||
<text>{{ value.viewCount }}次观看</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- #endif -->
|
||||
</template>
|
||||
|
||||
|
||||
<script>
|
||||
// 微信视频号组件
|
||||
import DiyMinx from './minx.js'
|
||||
export default {
|
||||
name: 'diy-wechat-channel',
|
||||
props: {
|
||||
value: {
|
||||
type: Object
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {};
|
||||
},
|
||||
created() { },
|
||||
mixins: [DiyMinx],
|
||||
watch: {
|
||||
// 组件刷新监听
|
||||
componentRefresh: function (nval) { }
|
||||
},
|
||||
computed: {
|
||||
channelWarpCss: function () {
|
||||
var obj = '';
|
||||
if (this.value.componentAngle == 'round') {
|
||||
obj += 'border-top-left-radius:' + this.value.topAroundRadius * 2 + 'rpx;';
|
||||
obj += 'border-top-right-radius:' + this.value.topAroundRadius * 2 + 'rpx;';
|
||||
obj += 'border-bottom-left-radius:' + this.value.bottomAroundRadius * 2 + 'rpx;';
|
||||
obj += 'border-bottom-right-radius:' + this.value.bottomAroundRadius * 2 + 'rpx;';
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async handlerClick() {
|
||||
await this.__$emitEvent({
|
||||
eventName: 'channel-tap', data: this.value, promiseCallback: (event, handler, awaitedResult) => {
|
||||
if (!awaitedResult) return;
|
||||
}
|
||||
})
|
||||
},
|
||||
async playVideo() {
|
||||
await this.__$emitEvent({
|
||||
eventName: 'video-play', data: this.value, promiseCallback: (event, handler, awaitedResult) => {
|
||||
if (!awaitedResult) return;
|
||||
// 检查微信环境
|
||||
if (typeof wx === 'undefined') {
|
||||
console.error('当前环境不是微信小程序');
|
||||
return;
|
||||
}
|
||||
// 检查基础库版本
|
||||
const systemInfo = wx.getSystemInfoSync();
|
||||
const SDKVersion = systemInfo.SDKVersion;
|
||||
const versionCompare = (v1, v2) => {
|
||||
const arr1 = v1.split('.');
|
||||
const arr2 = v2.split('.');
|
||||
for (let i = 0; i < Math.max(arr1.length, arr2.length); i++) {
|
||||
const num1 = parseInt(arr1[i] || 0);
|
||||
const num2 = parseInt(arr2[i] || 0);
|
||||
if (num1 > num2) return 1;
|
||||
if (num1 < num2) return -1;
|
||||
}
|
||||
return 0;
|
||||
};
|
||||
if (versionCompare(SDKVersion, '2.19.2') < 0) {
|
||||
console.error('当前微信基础库版本过低,需要 2.19.2 或以上版本');
|
||||
return;
|
||||
}
|
||||
// 调用微信视频号播放API
|
||||
if (wx.openChannelsActivity) {
|
||||
wx.openChannelsActivity({
|
||||
feedId: this.value.feedId,
|
||||
finderUserName: this.value.finderUserName,
|
||||
success: (res) => {
|
||||
console.log('打开视频号成功', res);
|
||||
},
|
||||
fail: (err) => {
|
||||
console.error('打开视频号失败', err);
|
||||
// 错误码处理
|
||||
switch (err.errCode) {
|
||||
case 40001:
|
||||
console.error('错误:40001,检查主体要求或嵌入式打开的关联关系');
|
||||
break;
|
||||
case 40002:
|
||||
console.error('错误:40002,参数错误,检查 feedId 和 finderUserName');
|
||||
break;
|
||||
default:
|
||||
console.error('错误:' + err.errCode + ',' + (err.errMsg || '未知错误'));
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
console.error('当前环境不支持微信视频号');
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.diy-wechat-channel {
|
||||
width: 100%;
|
||||
background-color: #fff;
|
||||
border-radius: 12rpx;
|
||||
overflow: hidden;
|
||||
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.08);
|
||||
}
|
||||
|
||||
.channel-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 16rpx;
|
||||
border-bottom: 1rpx solid #f0f0f0;
|
||||
}
|
||||
|
||||
.channel-avatar {
|
||||
width: 60rpx;
|
||||
height: 60rpx;
|
||||
border-radius: 50%;
|
||||
margin-right: 12rpx;
|
||||
}
|
||||
|
||||
.channel-info {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.channel-name {
|
||||
font-size: 28rpx;
|
||||
font-weight: 500;
|
||||
color: #333;
|
||||
margin-bottom: 4rpx;
|
||||
}
|
||||
|
||||
.channel-follow {
|
||||
font-size: 24rpx;
|
||||
color: #07c160;
|
||||
}
|
||||
|
||||
.channel-arrow {
|
||||
width: 24rpx;
|
||||
height: 24rpx;
|
||||
margin-left: 8rpx;
|
||||
}
|
||||
|
||||
.channel-video {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.video-cover {
|
||||
width: 100%;
|
||||
height: 320rpx;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
.video-play-btn {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
width: 80rpx;
|
||||
height: 80rpx;
|
||||
background-color: rgba(0, 0, 0, 0.4);
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.play-icon {
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
}
|
||||
|
||||
.video-info {
|
||||
padding: 16rpx;
|
||||
}
|
||||
|
||||
.video-title {
|
||||
font-size: 28rpx;
|
||||
font-weight: 500;
|
||||
color: #333;
|
||||
margin-bottom: 8rpx;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.video-stats {
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
}
|
||||
</style>
|
||||
@@ -270,7 +270,7 @@ export default {
|
||||
});
|
||||
|
||||
setTimeout(() => {
|
||||
this.$util.redirectTo('/pages/index/index');
|
||||
this.$util.redirectTo(this.$util.INDEX_PAGE_URL);
|
||||
}, 1000)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ export default {
|
||||
if (this.emptyBtn.url) {
|
||||
this.$util.redirectTo(this.emptyBtn.url, {}, 'redirectTo');
|
||||
} else {
|
||||
this.$util.redirectTo('/pages/index/index');
|
||||
this.$util.redirectTo(this.$util.INDEX_PAGE_URL);
|
||||
}
|
||||
},
|
||||
re(text) {
|
||||
|
||||
@@ -28,7 +28,7 @@ export default {
|
||||
*/
|
||||
addCart(config, data, event) {
|
||||
if (!this.storeToken) {
|
||||
this.$refs.login.open('/pages/index/index')
|
||||
this.$refs.login.open(this.$util.INDEX_PAGE_URL);
|
||||
return;
|
||||
}
|
||||
if (config == "detail" || data.is_virtual) {
|
||||
|
||||
@@ -413,7 +413,7 @@
|
||||
this.isLoad = false;
|
||||
if (callback) callback();
|
||||
} else {
|
||||
this.$util.redirectTo('/pages/index/index');
|
||||
this.$util.redirectTo(this.$util.INDEX_PAGE_URL);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -441,7 +441,7 @@
|
||||
this.skuId = res.data[0].sku_id;
|
||||
this.goodsSkuInfo = obj;
|
||||
} else {
|
||||
this.$util.redirectTo('/pages/index/index');
|
||||
this.$util.redirectTo(this.$util.INDEX_PAGE_URL);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -467,7 +467,7 @@
|
||||
this.skuId = res.data[0].sku_id;
|
||||
this.goodsSkuInfo = obj;
|
||||
} else {
|
||||
this.$util.redirectTo('/pages/index/index');
|
||||
this.$util.redirectTo(this.$util.INDEX_PAGE_URL);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -500,7 +500,7 @@
|
||||
this.skuId = res.data[0].sku_id;
|
||||
this.goodsSkuInfo = obj;
|
||||
} else {
|
||||
this.$util.redirectTo('/pages/index/index');
|
||||
this.$util.redirectTo(this.$util.INDEX_PAGE_URL);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -527,7 +527,7 @@
|
||||
this.skuId = res.data[0].sku_id;
|
||||
this.goodsSkuInfo = obj;
|
||||
} else {
|
||||
this.$util.redirectTo('/pages/index/index');
|
||||
this.$util.redirectTo(this.$util.INDEX_PAGE_URL);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -553,7 +553,7 @@
|
||||
this.skuId = res.data[0].sku_id;
|
||||
this.goodsSkuInfo = obj;
|
||||
} else {
|
||||
this.$util.redirectTo('/pages/index/index');
|
||||
this.$util.redirectTo(this.$util.INDEX_PAGE_URL);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -579,7 +579,7 @@
|
||||
this.skuId = res.data[0].sku_id;
|
||||
this.goodsSkuInfo = obj;
|
||||
} else {
|
||||
this.$util.redirectTo('/pages/index/index');
|
||||
this.$util.redirectTo(this.$util.INDEX_PAGE_URL);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -606,7 +606,7 @@
|
||||
this.skuId = res.data[0].sku_id;
|
||||
this.goodsSkuInfo = obj;
|
||||
} else {
|
||||
this.$util.redirectTo('/pages/index/index');
|
||||
this.$util.redirectTo(this.$util.INDEX_PAGE_URL);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -630,7 +630,7 @@
|
||||
this.skuId = res.data[0].sku_id;
|
||||
this.goodsSkuInfo = obj;
|
||||
} else {
|
||||
this.$util.redirectTo('/pages/index/index');
|
||||
this.$util.redirectTo(this.$util.INDEX_PAGE_URL);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -42,26 +42,22 @@
|
||||
|
||||
<!-- 协议勾选 -->
|
||||
<view style="display: flex;">
|
||||
<view
|
||||
class="iconfont"
|
||||
<view class="iconfont"
|
||||
:class="isAgree ? 'icon-fuxuankuang1 color-base-text' : 'icon-fuxuankuang2'"
|
||||
@click="isAgree = !isAgree"
|
||||
></view>
|
||||
@click="isAgree = !isAgree"></view>
|
||||
<view style="text-align: left; margin-left: 10rpx; padding-top: 2rpx; font-size: 28rpx;">
|
||||
我同意
|
||||
<text style="color: #4395ff;" @click="tourl('/pages_tool/agreement/contenr?type=0')">《隐私条款》</text>
|
||||
<text style="color: #4395ff;" @click="tourl('/pages_tool/agreement/contenr?type=1')">《用户服务协议》</text>
|
||||
<text style="color: #4395ff;"
|
||||
@click="tourl('/pages_tool/agreement/contenr?type=0')">《隐私条款》</text>
|
||||
<text style="color: #4395ff;"
|
||||
@click="tourl('/pages_tool/agreement/contenr?type=1')">《用户服务协议》</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 手机号授权按钮 -->
|
||||
<block v-if="isAgree">
|
||||
<button
|
||||
class="auth-login save-btn border-0"
|
||||
style="border: none;"
|
||||
open-type="getPhoneNumber"
|
||||
@getphonenumber="getPhoneNumber"
|
||||
>
|
||||
<button class="auth-login save-btn border-0" style="border: none;" open-type="getPhoneNumber"
|
||||
@getphonenumber="getPhoneNumber">
|
||||
<text style="color: #fff; font-size: 30rpx;">同意隐私协议并授权手机号</text>
|
||||
</button>
|
||||
</block>
|
||||
@@ -71,7 +67,8 @@
|
||||
</button>
|
||||
</block>
|
||||
|
||||
<view @click="closeLogin" style="font-size: 30rpx; color: #888; text-align: center; padding-top: 10rpx;">
|
||||
<view @click="closeLogin"
|
||||
style="font-size: 30rpx; color: #888; text-align: center; padding-top: 10rpx;">
|
||||
暂不登录
|
||||
</view>
|
||||
|
||||
@@ -118,8 +115,8 @@
|
||||
<text class="color-base-text" v-else>获取手机号</text>
|
||||
</button>
|
||||
</view>
|
||||
<button type="default" class="save-btn" @click="saveMp" :disabled="isDisabled">保存</button>
|
||||
</template>
|
||||
<button type="default" class="save-btn" @click="saveMp" :disabled="isDisabled">保存</button>
|
||||
</template>
|
||||
<!-- #endif -->
|
||||
</view>
|
||||
</uni-popup>
|
||||
@@ -226,7 +223,7 @@ export default {
|
||||
if (siteInfo) {
|
||||
this.site_name = siteInfo.site_name;
|
||||
}
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
// 同意协议
|
||||
authno() {
|
||||
@@ -254,7 +251,7 @@ export default {
|
||||
},
|
||||
|
||||
// 打开弹窗
|
||||
open(url) {
|
||||
open(url = '', mode = 'navigateTo') {
|
||||
if (url) this.url = url;
|
||||
// #ifdef MP
|
||||
this.getCode(authData => {
|
||||
@@ -266,28 +263,33 @@ export default {
|
||||
if (this.$util.isWeChatMiniProgram()) {
|
||||
// 微信小程序环境,使用微信授权登录
|
||||
let authData = uni.getStorageSync('authInfo');
|
||||
if (authData) this.authLogin(authData);
|
||||
else this.getCode();
|
||||
if (authData) {
|
||||
this.authLogin(authData);
|
||||
} else {
|
||||
this.getCode(authData => {
|
||||
this.authLogin(authData, 'authOnlyLogin');
|
||||
});
|
||||
}
|
||||
} else if (this.$util.isWeiXin()) {
|
||||
// 微信浏览器环境,显示登录页面
|
||||
this.toLogin();
|
||||
this.toLogin(mode);
|
||||
} else {
|
||||
// 其他浏览器环境,显示登录页面
|
||||
this.toLogin();
|
||||
this.toLogin(mode);
|
||||
}
|
||||
// #endif
|
||||
|
||||
// #ifndef MP || H5
|
||||
this.toLogin();
|
||||
this.toLogin(mode);
|
||||
// #endif
|
||||
},
|
||||
|
||||
// 跳转去登录页
|
||||
toLogin() {
|
||||
if (this.url) this.$util.redirectTo('/pages_tool/login/login', {
|
||||
toLogin(mode = 'navigateTo') {
|
||||
if (this.url) this.$util.redirectTo(this.$util.LOGIN_PAGE_URL, {
|
||||
back: encodeURIComponent(this.url)
|
||||
});
|
||||
else this.$util.redirectTo('/pages_tool/login/login');
|
||||
}, mode);
|
||||
else this.$util.redirectTo(this.$util.LOGIN_PAGE_URL, {}, mode);
|
||||
},
|
||||
|
||||
// 取消完善信息
|
||||
@@ -535,7 +537,8 @@ export default {
|
||||
getPhoneNumber(e) {
|
||||
if (e.detail.errMsg === 'getPhoneNumber:ok') {
|
||||
const authInfo = uni.getStorageSync('authInfo');
|
||||
if (authInfo) { Object.assign(this.authMobileData, authInfo, e.detail);
|
||||
if (authInfo) {
|
||||
Object.assign(this.authMobileData, authInfo, e.detail);
|
||||
}
|
||||
if (uni.getStorageSync('source_member')) {
|
||||
this.authMobileData.source_member = uni.getStorageSync('source_member');
|
||||
@@ -596,7 +599,7 @@ export default {
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
// 授权登录
|
||||
authLogin(data, type = 'authLogin') {
|
||||
uni.showLoading({
|
||||
@@ -686,8 +689,8 @@ export default {
|
||||
|
||||
if (this.forceBindingMobileControl) {
|
||||
this.bindMobile();
|
||||
} else {
|
||||
this.authLogin(authInfo);
|
||||
} else {
|
||||
this.authLogin(authInfo);
|
||||
}
|
||||
},
|
||||
|
||||
@@ -749,7 +752,7 @@ export default {
|
||||
// 跳转页面
|
||||
tourl(url) {
|
||||
this.$util.redirectTo(url);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -185,7 +185,7 @@ export default {
|
||||
title: '未获取到支付信息!'
|
||||
});
|
||||
setTimeout(() => {
|
||||
this.$util.redirectTo('/pages/index/index');
|
||||
this.$util.redirectTo(this.$util.INDEX_PAGE_URL);
|
||||
}, 1500);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,237 +1,385 @@
|
||||
<template>
|
||||
<!-- #ifdef MP -->
|
||||
<view v-if="showPop">
|
||||
<view class="privacy-mask">
|
||||
<view>
|
||||
<view class="privacy-mask" v-if="showPop">
|
||||
<view class="privacy-wrap">
|
||||
<view class="privacy-title">用户隐私保护提示</view>
|
||||
<view class="privacy-desc">
|
||||
感谢您使用本小程序,在使用前您应当阅读并同意
|
||||
<text class="privacy-link" @tap="openPrivacyContract">{{privacyContractName}}</text>,
|
||||
当点击同意并继续时,即表示您已理解并同意该条款内容,该条款将对您产生法律约束力;如您不同意,将无法继续使用小程序相关功能。
|
||||
感谢您使用{{ appName }},在使用前您应当阅读并同意
|
||||
<text class="privacy-link" @tap="openPrivacyContract">{{ privacyContractName }}</text>
|
||||
<!-- #ifdef QUICKAPP-WEBVIEW || H5 -->
|
||||
<text class="privacy-link" @tap="openPrivacyService">{{ privacyServiceName }}</text>
|
||||
<!-- #endif -->
|
||||
,当点击同意并继续时,即表示您已理解并同意该条款内容,该条款将对您产生法律约束力;如您不同意,将无法继续使用{{ appName }}相关功能。
|
||||
</view>
|
||||
<view class="privacy-button-flex">
|
||||
<button class="privacy-button-btn bg-disagree" @tap="handleDisagree">不同意</button>
|
||||
<button id="agree-btn" class="privacy-button-btn bg-agree" open-type="agreePrivacyAuthorization" @agreeprivacyauthorization="handleAgree">同意并继续</button>
|
||||
<!-- #ifdef QUICKAPP-WEBVIEW || MP-WEIXIN -->
|
||||
<button id="agree-btn" class="privacy-button-btn bg-agree" open-type="agreePrivacyAuthorization"
|
||||
@agreeprivacyauthorization="handleAgree">同意并继续</button>
|
||||
<!-- #endif -->
|
||||
<!-- #ifdef WEB || H5 -->
|
||||
<button id="agree-btn" class="privacy-button-btn bg-agree" @tap="handleAgree" @click="handleAgree">同意并继续</button>
|
||||
<!-- #endif -->
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- #endif -->
|
||||
<!-- #ifdef WEB || H5 -->
|
||||
<view v-if="showPop"></view>
|
||||
<!-- #endif -->
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
agree: false,
|
||||
showPop: false,
|
||||
privacyAuthorization: null,
|
||||
privacyResolves: new Set(),
|
||||
closeOtherPagePopUpHooks: new Set(),
|
||||
privacyContractName: '用户隐私保护指引'
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.init()
|
||||
this.curPageShow()
|
||||
},
|
||||
created() {
|
||||
let that = this
|
||||
// #ifdef QUICKAPP-WEBVIEW
|
||||
import has from '@system.has'
|
||||
// #endif
|
||||
|
||||
const closeOtherPagePopUpHooks = new Set();
|
||||
const privacyContractPage = '/pages_tool/agreement/contenr?type=0';
|
||||
const privacyServicePage = '/pages_tool/agreement/contenr?type=1';
|
||||
|
||||
export default {
|
||||
name: 'PrivacyPopup',
|
||||
data() {
|
||||
return {
|
||||
agree: false,
|
||||
showPop: false,
|
||||
privacyAuthorization: null,
|
||||
privacyResolves: new Set(),
|
||||
privacyContractName: '用户隐私保护指引',
|
||||
appName: '本小程序',
|
||||
// #ifdef WEB || H5
|
||||
appName: '本应用',
|
||||
privacyContractName: '《隐私条款》',
|
||||
privacyServiceName: '《用户服务协议》',
|
||||
// #endif
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.listenPrivacySettingChange()
|
||||
this.curPageShow()
|
||||
},
|
||||
created() {
|
||||
try {
|
||||
// #ifdef MP-WEIXIN
|
||||
//查询微信侧记录的用户是否有待同意的隐私政策信息
|
||||
try {
|
||||
wx.getPrivacySetting({
|
||||
success(res) {
|
||||
// console.log('隐私政策信息', res);
|
||||
// console.log(res.privacyContractName);
|
||||
that.privacyContractName = res.privacyContractName
|
||||
}
|
||||
});
|
||||
} catch (e) {
|
||||
// console.log("=========低版本基础库==========")
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 监听何时需要提示用户阅读隐私政策
|
||||
init() {
|
||||
let that = this;
|
||||
if (wx.onNeedPrivacyAuthorization) {
|
||||
wx.onNeedPrivacyAuthorization((resolve) => {
|
||||
if (typeof that.privacyAuthorization === 'function') {
|
||||
that.privacyAuthorization(resolve)
|
||||
}
|
||||
wx.getPrivacySetting({
|
||||
success: (res) => {
|
||||
// console.log('隐私政策信息', res);
|
||||
// console.log(res.privacyContractName);
|
||||
this.privacyContractName = res.privacyContractName
|
||||
}
|
||||
});
|
||||
// #endif
|
||||
|
||||
// #ifdef QUICKAPP-WEBVIEW || H5
|
||||
if (this.$util.isQuickApp()) {
|
||||
if (typeof has != 'undefined' && has?.getPrivacySetting) {
|
||||
has.getPrivacySetting({
|
||||
success: (res) => {
|
||||
if (res.privacyContractName) {
|
||||
this.privacyContractName = res.privacyContractName
|
||||
}
|
||||
},
|
||||
})
|
||||
}
|
||||
},
|
||||
proactive() {
|
||||
let that = this
|
||||
if (wx.getPrivacySetting) {
|
||||
wx.getPrivacySetting({
|
||||
}
|
||||
// #endif
|
||||
} catch (e) {
|
||||
console.error("=========低版本基础库==========", e)
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
getPrivacySettingByQuickApp() {
|
||||
// #ifdef QUICKAPP-WEBVIEW || H5 || WEB
|
||||
if (this.$util.isQuickApp()) {
|
||||
if (typeof has != 'undefined' && has?.getPrivacySetting) {
|
||||
has.getPrivacySetting({
|
||||
success: (res) => {
|
||||
// console.log(res)
|
||||
if (res.needAuthorization) {
|
||||
that.popUp()
|
||||
this.popUp()
|
||||
// 额外逻辑:当前页面的隐私弹窗弹起的时候,关掉其他页面的隐私弹窗
|
||||
this.closeOtherPagePopUp(this.disPopUp)
|
||||
} else {
|
||||
this.$emit('agree')
|
||||
}
|
||||
},
|
||||
})
|
||||
} else {
|
||||
// 属于嵌入到快应用Webview组件中的情况,按照H5的方式来处理,判断是否已经授权
|
||||
if (uni.getStorageSync('privacyAgreed')) {
|
||||
this.$emit('agree')
|
||||
} else {
|
||||
this.popUp()
|
||||
// 额外逻辑:当前页面的隐私弹窗弹起的时候,关掉其他页面的隐私弹窗
|
||||
this.closeOtherPagePopUp(this.disPopUp)
|
||||
}
|
||||
}
|
||||
}
|
||||
// #endif
|
||||
},
|
||||
|
||||
listenPrivacySettingChange() {
|
||||
// #ifdef MP-WEIXIN
|
||||
// 监听微信侧隐私政策授权变化事件
|
||||
if (wx.onNeedPrivacyAuthorization) {
|
||||
wx.onNeedPrivacyAuthorization((resolve) => {
|
||||
if (typeof this.privacyAuthorization === 'function') {
|
||||
this.privacyAuthorization(resolve)
|
||||
}
|
||||
})
|
||||
}
|
||||
// #endif
|
||||
|
||||
// #ifdef QUICKAPP-WEBVIEW || H5 || WEB
|
||||
if (this.$util.isQuickApp()) {
|
||||
// 监听快速应用侧隐私政策授权变化事件
|
||||
if (typeof has != 'undefined' && has?.onPrivacySettingChange) {
|
||||
has.onPrivacySettingChange((res) => {
|
||||
// console.log(res)
|
||||
if (res.needAuthorization) {
|
||||
this.popUp()
|
||||
// 额外逻辑:当前页面的隐私弹窗弹起的时候,关掉其他页面的隐私弹窗
|
||||
this.closeOtherPagePopUp(this.disPopUp)
|
||||
} else {
|
||||
this.$emit('agree')
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
// #endif
|
||||
|
||||
// 主动查询用户隐私政策授权状态,针对快速应用
|
||||
this.getPrivacySettingByQuickApp();
|
||||
},
|
||||
// 主动查询用户隐私政策授权状态
|
||||
proactive() {
|
||||
// #ifdef MP-WEIXIN
|
||||
if (wx.getPrivacySetting) {
|
||||
wx.getPrivacySetting({
|
||||
success: (res) => {
|
||||
// console.log(res)
|
||||
if (res.needAuthorization) {
|
||||
this.popUp()
|
||||
// 额外逻辑:当前页面的隐私弹窗弹起的时候,关掉其他页面的隐私弹窗
|
||||
this.closeOtherPagePopUp(this.disPopUp)
|
||||
} else {
|
||||
this.$emit('agree')
|
||||
}
|
||||
},
|
||||
});
|
||||
} else {
|
||||
this.$emit('agree')
|
||||
}
|
||||
// #endif
|
||||
|
||||
// #ifdef QUICKAPP-WEBVIEW
|
||||
this.getPrivacySettingByQuickApp();
|
||||
// #endif
|
||||
},
|
||||
//初始化监听程序
|
||||
curPageShow() {
|
||||
closeOtherPagePopUpHooks.add(this.disPopUp)
|
||||
this.privacyAuthorization = resolve => {
|
||||
this.privacyResolves.add(resolve)
|
||||
//打开弹窗
|
||||
this.popUp()
|
||||
// 额外逻辑:当前页面的隐私弹窗弹起的时候,关掉其他页面的隐私弹窗
|
||||
this.closeOtherPagePopUp(this.disPopUp)
|
||||
}
|
||||
},
|
||||
// 额外逻辑:当前页面的隐私弹窗弹起的时候,关掉其他页面的隐私弹窗
|
||||
closeOtherPagePopUp(closePopUp) {
|
||||
closeOtherPagePopUpHooks.forEach(hook => {
|
||||
if (closePopUp !== hook) {
|
||||
hook()
|
||||
}
|
||||
})
|
||||
},
|
||||
//打开隐私协议
|
||||
openPrivacyContract() {
|
||||
// #ifdef MP-WEIXIN
|
||||
wx.openPrivacyContract({
|
||||
success(res) {
|
||||
// console.log('打开隐私协议', res);
|
||||
},
|
||||
fail(err) {
|
||||
// console.error('打开隐私协议失败', err)
|
||||
}
|
||||
});
|
||||
// #endif
|
||||
|
||||
// #ifdef QUICKAPP-WEBVIEW || H5 || WEB
|
||||
if (this.$util.isQuickApp()) {
|
||||
if (typeof has != 'undefined' && has?.openPrivacySetting) {
|
||||
has.openPrivacySetting({
|
||||
success: (res) => {
|
||||
// console.log('打开隐私协议', res);
|
||||
},
|
||||
fail: (err) => {
|
||||
// console.error('打开隐私协议失败', err)
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.$emit('agree')
|
||||
// 属于嵌入到快应用Webview组件中的情况,按照H5的方式来处理
|
||||
this.$util.redirectTo(privacyContractPage);
|
||||
}
|
||||
},
|
||||
//初始化监听程序
|
||||
curPageShow() {
|
||||
this.privacyAuthorization = resolve => {
|
||||
this.privacyResolves.add(resolve)
|
||||
//打开弹窗
|
||||
this.popUp()
|
||||
// 额外逻辑:当前页面的隐私弹窗弹起的时候,关掉其他页面的隐私弹窗
|
||||
this.closeOtherPagePopUp(this.disPopUp)
|
||||
} else {
|
||||
// H5 环境下的处理逻辑
|
||||
this.$util.redirectTo(privacyContractPage);
|
||||
}
|
||||
// #endif
|
||||
},
|
||||
//打开用户服务协议
|
||||
openPrivacyService() {
|
||||
// #ifdef QUICKAPP-WEBVIEW || H5 || WEB
|
||||
if (this.$util.isQuickApp()) {
|
||||
if (typeof has != 'undefined' && has?.openPrivacySetting) {
|
||||
has.openPrivacySetting({
|
||||
success: (res) => {
|
||||
// console.log('打开用户服务协议', res);
|
||||
},
|
||||
fail: (err) => {
|
||||
// console.error('打开用户服务协议失败', err)
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// 属于嵌入到快应用Webview组件中的情况,按照H5的方式来处理
|
||||
this.$util.redirectTo(privacyServicePage);
|
||||
}
|
||||
this.closeOtherPagePopUpHooks.add(this.disPopUp)
|
||||
},
|
||||
// 额外逻辑:当前页面的隐私弹窗弹起的时候,关掉其他页面的隐私弹窗
|
||||
closeOtherPagePopUp(closePopUp) {
|
||||
this.closeOtherPagePopUpHooks.forEach(hook => {
|
||||
if (closePopUp !== hook) {
|
||||
hook()
|
||||
}
|
||||
} else {
|
||||
// H5 环境下的处理逻辑
|
||||
this.$util.redirectTo(privacyServicePage);
|
||||
}
|
||||
// #endif
|
||||
},
|
||||
// 不同意
|
||||
handleDisagree() {
|
||||
this.privacyResolves.forEach(resolve => {
|
||||
resolve({
|
||||
event: 'disagree',
|
||||
})
|
||||
},
|
||||
//打开隐私协议
|
||||
openPrivacyContract() {
|
||||
wx.openPrivacyContract({
|
||||
success(res) {
|
||||
// console.log('打开隐私协议', res);
|
||||
},
|
||||
fail(err) {
|
||||
// console.error('打开隐私协议失败', err)
|
||||
}
|
||||
});
|
||||
},
|
||||
// 不同意
|
||||
handleDisagree() {
|
||||
this.privacyResolves.forEach(resolve => {
|
||||
resolve({
|
||||
event: 'disagree',
|
||||
})
|
||||
})
|
||||
this.privacyResolves.clear()
|
||||
//关闭弹窗
|
||||
this.disPopUp()
|
||||
//退出小程序
|
||||
uni.showModal({
|
||||
content: '未同意隐私协议,无法使用相关功能',
|
||||
success: () => {
|
||||
this.$emit('disagree')
|
||||
}
|
||||
})
|
||||
},
|
||||
// 同意并继续
|
||||
handleAgree() {
|
||||
this.privacyResolves.forEach(resolve => {
|
||||
resolve({
|
||||
event: 'agree',
|
||||
buttonId: 'agree-btn'
|
||||
})
|
||||
})
|
||||
this.privacyResolves.clear()
|
||||
//关闭弹窗
|
||||
this.disPopUp()
|
||||
this.$emit('agree')
|
||||
},
|
||||
//打开弹窗
|
||||
popUp() {
|
||||
if (this.showPop === false) {
|
||||
this.showPop = true
|
||||
}
|
||||
},
|
||||
})
|
||||
this.privacyResolves.clear()
|
||||
//关闭弹窗
|
||||
disPopUp() {
|
||||
if (this.showPop === true) {
|
||||
this.showPop = false
|
||||
this.disPopUp()
|
||||
//退出小程序
|
||||
uni.showModal({
|
||||
content: '未同意隐私协议,无法使用相关功能',
|
||||
success: () => {
|
||||
this.$emit('disagree')
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
// 同意并继续
|
||||
handleAgree() {
|
||||
this.privacyResolves.forEach(resolve => {
|
||||
resolve({
|
||||
event: 'agree',
|
||||
buttonId: 'agree-btn'
|
||||
})
|
||||
})
|
||||
this.privacyResolves.clear()
|
||||
//关闭弹窗
|
||||
this.disPopUp()
|
||||
|
||||
// #ifdef QUICKAPP-WEBVIEW || H5 || WEB
|
||||
// 保存用户授权状态到本地存储,用于快应用Webview组件中的H5方式处理
|
||||
uni.setStorageSync('privacyAgreed', true);
|
||||
// #endif
|
||||
this.$emit('agree')
|
||||
},
|
||||
//打开弹窗
|
||||
popUp() {
|
||||
this.showPop = true;
|
||||
},
|
||||
//关闭弹窗
|
||||
disPopUp() {
|
||||
this.showPop = false;
|
||||
},
|
||||
},
|
||||
beforeDestroy() {
|
||||
// 清理事件监听器和集合
|
||||
this.privacyResolves.clear()
|
||||
closeOtherPagePopUpHooks.delete(this.disPopUp)
|
||||
// 注意:这里需要根据实际情况清理微信和快速应用的事件监听器
|
||||
// 由于微信的 wx.onNeedPrivacyAuthorization 没有对应的 off 方法,这里可能需要其他方式处理
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.privacy-mask {
|
||||
position: fixed;
|
||||
z-index: 5000;
|
||||
top: 0;
|
||||
right: 0;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
background: rgba(0, 0, 0, 0.2);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.privacy-mask {
|
||||
position: fixed;
|
||||
z-index: 5000;
|
||||
top: 0;
|
||||
right: 0;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
background: rgba(0, 0, 0, 0.2);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.privacy-wrap {
|
||||
width: 632rpx;
|
||||
padding: 48rpx 30rpx;
|
||||
box-sizing: border-box;
|
||||
background: #fff;
|
||||
border-radius: 16rpx;
|
||||
}
|
||||
.privacy-wrap {
|
||||
width: 632rpx;
|
||||
padding: 48rpx 30rpx;
|
||||
box-sizing: border-box;
|
||||
background: #fff;
|
||||
border-radius: 16rpx;
|
||||
}
|
||||
|
||||
.privacy-title {
|
||||
padding: 0rpx 30rpx 40rpx 30rpx;
|
||||
font-weight: 700;
|
||||
font-size: 36rpx;
|
||||
text-align: center;
|
||||
}
|
||||
.privacy-title {
|
||||
padding: 0rpx 30rpx 40rpx 30rpx;
|
||||
font-weight: 700;
|
||||
font-size: 36rpx;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.privacy-desc {
|
||||
font-size: 30rpx;
|
||||
color: #555;
|
||||
line-height: 2;
|
||||
text-align: left;
|
||||
padding: 0 40rpx;
|
||||
}
|
||||
.privacy-desc {
|
||||
font-size: 30rpx;
|
||||
color: #555;
|
||||
line-height: 2;
|
||||
text-align: left;
|
||||
padding: 0 40rpx;
|
||||
}
|
||||
|
||||
.privacy-link {
|
||||
color: #2f80ed;
|
||||
}
|
||||
.privacy-link {
|
||||
color: #2f80ed;
|
||||
}
|
||||
|
||||
.privacy-button-flex {
|
||||
display: flex;
|
||||
padding: 20rpx 40rpx;
|
||||
}
|
||||
.privacy-button-flex {
|
||||
display: flex;
|
||||
padding: 20rpx 40rpx;
|
||||
}
|
||||
|
||||
.privacy-button-btn {
|
||||
color: #FFF;
|
||||
font-size: 30rpx;
|
||||
font-weight: 500;
|
||||
line-height: 100rpx;
|
||||
text-align: center;
|
||||
height: 100rpx;
|
||||
border-radius: 20rpx;
|
||||
border: none;
|
||||
background: #07c160;
|
||||
flex: 1;
|
||||
margin-right: 30rpx;
|
||||
justify-content: center;
|
||||
}
|
||||
.privacy-button-btn {
|
||||
color: #FFF;
|
||||
font-size: 30rpx;
|
||||
// #ifdef QUICKAPP-WEBVIEW || H5 || WEB
|
||||
font-size: 28rpx;
|
||||
// #endif
|
||||
font-weight: 500;
|
||||
line-height: 100rpx;
|
||||
text-align: center;
|
||||
height: 100rpx;
|
||||
border-radius: 20rpx;
|
||||
border: none;
|
||||
background: #07c160;
|
||||
flex: 1;
|
||||
margin-right: 30rpx;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.privacy-button-btn::after {
|
||||
border: none;
|
||||
}
|
||||
.privacy-button-btn::after {
|
||||
border: none;
|
||||
}
|
||||
|
||||
.bg-disagree {
|
||||
color: #07c160;
|
||||
background: #f2f2f2;
|
||||
}
|
||||
.bg-disagree {
|
||||
color: #07c160;
|
||||
background: #f2f2f2;
|
||||
}
|
||||
|
||||
.bg-agree {
|
||||
margin-right: 0rpx;
|
||||
}
|
||||
.bg-agree {
|
||||
margin-right: 0rpx;
|
||||
}
|
||||
</style>
|
||||
@@ -138,7 +138,7 @@
|
||||
break;
|
||||
default:
|
||||
if (this.back) this.$util.redirectTo(decodeURIComponent(this.back), {}, 'redirectTo');
|
||||
else this.$util.redirectTo('/pages/index/index');
|
||||
else this.$util.redirectTo(this.$util.INDEX_PAGE_URL);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
452
docs/WECHAT_CHANNEL_INTEGRATION.md
Normal file
452
docs/WECHAT_CHANNEL_INTEGRATION.md
Normal file
@@ -0,0 +1,452 @@
|
||||
# 微信视频号集成指南
|
||||
|
||||
## 1. 概述
|
||||
|
||||
本文档提供了在UniApp项目中集成微信视频号的详细指导,包括组件实现、配置修改和使用方法。
|
||||
|
||||
## 2. 准备工作
|
||||
|
||||
### 2.1 微信小程序配置
|
||||
|
||||
在 `manifest.json` 文件中,需要确保微信小程序配置正确:
|
||||
|
||||
```json
|
||||
"mp-weixin": {
|
||||
"appid": "你的小程序appid",
|
||||
"setting": {
|
||||
"urlCheck": false,
|
||||
"postcss": false,
|
||||
"es6": true,
|
||||
"minified": true
|
||||
},
|
||||
"usingComponents": true,
|
||||
"permission": {
|
||||
"scope.userLocation": {
|
||||
"desc": "为了更好地为您提供服务"
|
||||
}
|
||||
},
|
||||
"requiredPrivateInfos": ["chooseLocation", "getLocation", "chooseAddress"],
|
||||
"__usePrivacyCheck__": true,
|
||||
"optimization": {
|
||||
"subPackages": true
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 2.2 微信视频号API权限与关联
|
||||
|
||||
#### 2.2.1 权限说明
|
||||
|
||||
`wx.openChannelsActivity` API 是小程序的基础能力,不需要单独开通权限,但需要满足以下条件:
|
||||
|
||||
- **跳转打开视频号视频**:无主体限制,基础库版本 2.19.2 及以上
|
||||
- **内嵌视频号视频**:
|
||||
- 从基础库版本 2.25.1 至 2.31.1,小程序需与视频号视频相同主体或关联主体
|
||||
- 从基础库版本 2.31.1 开始,非个人主体小程序可内嵌非同主体/关联主体视频号视频
|
||||
|
||||
#### 2.2.2 小程序与视频号关联(可选)
|
||||
|
||||
虽然跳转打开视频号视频无主体限制,但如果需要内嵌非同主体视频号视频(基础库 2.31.1 以下),则需要关联小程序与视频号:
|
||||
|
||||
1. **小程序管理员操作**
|
||||
- 登录微信小程序后台
|
||||
- 左侧菜单:设置 → 基本设置
|
||||
- 向下滚动找到「关联设置」部分
|
||||
- 点击「关联视频号」按钮
|
||||
- 输入视频号名称或视频号ID
|
||||
- 点击「搜索」找到对应的视频号
|
||||
- 点击「发送关联邀请」
|
||||
|
||||
2. **视频号管理员操作**
|
||||
- 视频号管理员需要在24小时内确认关联邀请
|
||||
- 视频号管理员登录 [视频号助手](https://channels.weixin.qq.com/)
|
||||
- 进入「设置」→「关联设置」→「小程序关联」
|
||||
- 找到待确认的关联邀请
|
||||
- 点击「同意」完成关联
|
||||
|
||||
3. **关联失败处理**
|
||||
- 检查视频号是否已完成实名认证
|
||||
- 检查小程序是否已发布上线
|
||||
- 检查视频号名称或ID是否输入正确
|
||||
- 如超过24小时未确认,需要重新发送关联邀请
|
||||
|
||||
#### 2.2.3 关联条件
|
||||
|
||||
- **小程序要求**:必须已经发布上线,未被处罚或限制
|
||||
- **视频号要求**:必须已经完成实名认证,状态正常
|
||||
- **数量限制**:同一个小程序最多可以关联50个视频号,同一个视频号最多可以关联50个小程序
|
||||
- **权限要求**:关联操作需要小程序管理员和视频号管理员共同确认
|
||||
- **主体要求**:小程序和视频号的主体可以不同,但需要双方管理员确认
|
||||
|
||||
#### 2.2.4 功能验证
|
||||
|
||||
可以通过以下方式验证视频号功能是否可用:
|
||||
|
||||
1. **在微信开发者工具中验证**
|
||||
- 在微信开发者工具中打开小程序
|
||||
- 在控制台执行以下代码:
|
||||
```javascript
|
||||
console.log('是否支持视频号API:', typeof wx !== 'undefined' && typeof wx.openChannelsActivity === 'function');
|
||||
```
|
||||
- 如果返回 `true`,则表示API可用
|
||||
|
||||
2. **在真机环境中验证**
|
||||
- 使用微信扫码打开小程序
|
||||
- 触发视频号相关功能
|
||||
- 检查是否能正常打开视频号内容
|
||||
|
||||
3. **功能验证失败处理**
|
||||
- 检查微信小程序基础库版本是否满足要求(跳转打开需要 2.19.2+,内嵌打开需要 2.25.1+)
|
||||
- 对于内嵌打开,检查主体是否满足要求或是否已关联
|
||||
- 检查 `feedId` 等参数是否正确
|
||||
|
||||
## 3. 组件使用
|
||||
|
||||
### 3.1 单个视频号组件 (diy-wechat-channel.vue)
|
||||
|
||||
#### 基本用法
|
||||
|
||||
```vue
|
||||
<diy-wechat-channel :value="channelData" />
|
||||
```
|
||||
|
||||
#### 属性说明
|
||||
|
||||
| 属性名 | 类型 | 默认值 | 说明 |
|
||||
|--------|------|--------|------|
|
||||
| channelName | String | "" | 视频号名称 |
|
||||
| avatarUrl | String | "" | 视频号头像URL |
|
||||
| videoTitle | String | "" | 视频标题 |
|
||||
| coverUrl | String | "" | 视频封面URL |
|
||||
| feedId | String | "" | 视频号内容ID,用于播放视频 |
|
||||
| viewCount | Number | 0 | 视频观看次数 |
|
||||
| showFollow | Boolean | false | 是否显示关注按钮 |
|
||||
| componentAngle | String | "" | 组件圆角类型,可选值:round |
|
||||
| topAroundRadius | Number | 0 | 顶部圆角半径 |
|
||||
| bottomAroundRadius | Number | 0 | 底部圆角半径 |
|
||||
|
||||
#### 事件说明
|
||||
|
||||
| 事件名 | 说明 | 参数 |
|
||||
|--------|------|------|
|
||||
| channel-tap | 点击视频号头像或名称时触发 | 视频号数据对象 |
|
||||
| video-play | 点击视频播放时触发 | 视频号数据对象 |
|
||||
|
||||
### 3.2 视频号列表组件 (diy-wechat-channel-list.vue)
|
||||
|
||||
#### 基本用法
|
||||
|
||||
```vue
|
||||
<diy-wechat-channel-list :value="channelListData" />
|
||||
```
|
||||
|
||||
#### 属性说明
|
||||
|
||||
| 属性名 | 类型 | 默认值 | 说明 |
|
||||
|--------|------|--------|------|
|
||||
| list | Array | [] | 视频号列表数据 |
|
||||
| rowCount | Number | 2 | 每行显示的视频号数量 |
|
||||
| showStyle | String | "fixed" | 显示样式,可选值:fixed, singleSlide |
|
||||
| mode | String | "" | 显示模式 |
|
||||
| font | Object | {} | 字体样式配置 |
|
||||
| componentBgColor | String | "#fff" | 组件背景颜色 |
|
||||
| componentAngle | String | "" | 组件圆角类型,可选值:round |
|
||||
| topAroundRadius | Number | 0 | 顶部圆角半径 |
|
||||
| bottomAroundRadius | Number | 0 | 底部圆角半径 |
|
||||
| ornament | Object | {} | 装饰样式配置 |
|
||||
|
||||
#### list数组项说明
|
||||
|
||||
| 属性名 | 类型 | 默认值 | 说明 |
|
||||
|--------|------|--------|------|
|
||||
| channelName | String | "" | 视频号名称 |
|
||||
| coverUrl | String | "" | 视频封面URL |
|
||||
| videoTitle | String | "" | 视频标题 |
|
||||
| feedId | String | "" | 视频号内容ID,用于播放视频 |
|
||||
| viewCount | Number | 0 | 视频观看次数 |
|
||||
|
||||
## 4. 视频播放实现
|
||||
|
||||
小程序提供两种打开视频号视频的方式:跳转打开和内嵌打开。
|
||||
|
||||
### 4.1 跳转打开视频号视频
|
||||
|
||||
组件内部使用微信小程序的 `wx.openChannelsActivity` API 来打开视频号内容:
|
||||
|
||||
```javascript
|
||||
if (typeof wx !== 'undefined' && wx.openChannelsActivity) {
|
||||
wx.openChannelsActivity({
|
||||
feedId: item.feedId, // 视频号内容ID,必填
|
||||
finderUserName: item.finderUserName, // 视频号ID(可选)
|
||||
success: (res) => {
|
||||
console.log('打开视频号成功', res);
|
||||
},
|
||||
fail: (err) => {
|
||||
console.error('打开视频号失败', err);
|
||||
// 常见错误处理
|
||||
if (err.errCode === 40001) {
|
||||
console.error('未授权,请检查小程序是否与视频号关联');
|
||||
} else if (err.errCode === 40002) {
|
||||
console.error('参数错误,请检查feedId是否正确');
|
||||
} else if (err.errCode === 40003) {
|
||||
console.error('视频号内容不存在或已被删除');
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
console.error('当前环境不支持微信视频号');
|
||||
}
|
||||
```
|
||||
|
||||
### 4.2 内嵌视频号视频
|
||||
|
||||
从基础库 2.25.1 开始支持,小程序可以通过 `channel-video` 组件在小程序中内嵌视频号视频,且支持无弹窗跳转打开视频号对应视频,使用该组件时需注意:
|
||||
|
||||
- 组件调用无资质要求
|
||||
- 暂不支持纯图片视频号内容
|
||||
- 在 UniApp 中使用时,需要用 `<native-component>` 包裹以确保组件正确显示
|
||||
|
||||
```vue
|
||||
<!-- #ifdef MP-WEIXIN -->
|
||||
<native-component>
|
||||
<channel-video
|
||||
feed-id="{{feedId}}"
|
||||
finder-user-name="{{finderUserName}}"
|
||||
feed-token="{{feedToken}}"
|
||||
bindenterfullscreen="enterFullscreen"
|
||||
bindexitfullscreen="exitFullscreen"
|
||||
binderror="videoError"
|
||||
></channel-video>
|
||||
</native-component>
|
||||
<!-- #endif -->
|
||||
```
|
||||
|
||||
### 4.3 API参数说明
|
||||
|
||||
- **feedId**:视频号内容ID,必填,必须是有效的视频号内容ID
|
||||
- **finderUserName**:视频号ID,可选
|
||||
- **feedToken**:非同主体视频号视频的标识,从基础库 2.31.1 开始支持,非个人主体小程序可使用
|
||||
- **success**:调用成功的回调函数
|
||||
- **fail**:调用失败的回调函数
|
||||
- **complete**:调用完成的回调函数(无论成功或失败)
|
||||
|
||||
### 4.4 错误码说明
|
||||
|
||||
| 错误码 | 说明 | 解决方案 |
|
||||
|--------|------|----------|
|
||||
| 40001 | 未授权 | 对于内嵌打开,检查主体是否满足要求或是否已关联 |
|
||||
| 40002 | 参数错误 | 检查feedId是否正确,确保是有效的视频号内容ID |
|
||||
| 40003 | 视频号内容不存在或已被删除 | 确认feedId对应的视频号内容是否仍然存在 |
|
||||
| 40004 | 系统错误 | 稍后重试,或联系微信公众平台客服 |
|
||||
|
||||
### 4.5 获取参数方法
|
||||
|
||||
1. **获取finderUserName(视频号ID)**
|
||||
- 登录视频号助手
|
||||
- 在首页可以查看自己的视频号ID
|
||||
|
||||
2. **获取feedId(视频号内容ID)**
|
||||
- 登录视频号助手
|
||||
- 在「动态管理」模块可以复制自己发表的每个视频对应的feedId
|
||||
|
||||
3. **获取feed-token(非同主体视频号视频标识)**
|
||||
- 登录MP平台,在「设置-基本设置-隐私与安全」找到「获取视频号视频ID权限」,并将开关打开
|
||||
- 移动端找到想要内嵌的视频号视频,并复制该视频的feed-token
|
||||
- 注意:打开开关后24小时内生效,失效后需要再次打开开关;开关打开状态仅对当前操作者生效
|
||||
|
||||
### 4.6 主体判断逻辑
|
||||
|
||||
#### 主体信息查询
|
||||
小程序主体信息可通过小程序资料页-开发团队进行查询,视频号主体信息可通过视频号首页-认证进行查询。
|
||||
|
||||
#### 主体判断逻辑
|
||||
- **跳转打开视频号视频**:无主体限制,基础库版本 2.19.2 及以上
|
||||
- **内嵌视频号视频**:
|
||||
- 从基础库版本 2.25.1 至 2.31.1,小程序需与视频号视频相同主体或关联主体
|
||||
- 从基础库版本 2.31.1 开始,非个人主体小程序可内嵌非同主体/关联主体视频号视频
|
||||
|
||||
关联主体申请流程可以参考:https://kf.qq.com/faq/190726e6JFja190726qMJBn6.html
|
||||
|
||||
|
||||
|
||||
## 5. 注意事项
|
||||
|
||||
### 5.1 环境限制
|
||||
|
||||
- 微信视频号API只能在微信小程序环境中使用,其他环境(如H5、App)不支持
|
||||
- 跳转打开视频号视频需要微信小程序基础库版本 2.19.2 及以上
|
||||
- 内嵌视频号视频需要微信小程序基础库版本 2.25.1 及以上
|
||||
- 小程序与视频号关联仅在需要内嵌非同主体视频号视频(基础库 2.31.1 以下)时需要
|
||||
- 必须确保在 `manifest.json` 中设置 `usingComponents: true` 以启用组件支持
|
||||
|
||||
### 5.2 数据格式
|
||||
|
||||
确保传递给组件的数据格式正确,特别是 `feedId` 必须是有效的视频号内容ID
|
||||
|
||||
### 5.3 图片资源
|
||||
|
||||
- 视频号头像和封面图片建议使用CDN地址,确保加载速度
|
||||
- 图片尺寸建议:
|
||||
- 头像:200x200px
|
||||
- 封面:640x360px
|
||||
|
||||
### 5.4 权限和关联
|
||||
|
||||
- 确保在微信小程序后台开通了「打开视频号内容」权限
|
||||
- 确保小程序已与视频号成功关联
|
||||
- 关联操作需要小程序管理员和视频号管理员共同确认
|
||||
|
||||
## 6. 常见问题
|
||||
|
||||
### 6.1 视频无法播放
|
||||
|
||||
- 检查 `feedId` 是否正确,确保是有效的视频号内容ID
|
||||
- 检查微信小程序基础库版本是否满足要求(跳转打开需要 2.19.2+,内嵌打开需要 2.25.1+)
|
||||
- 对于内嵌打开,检查主体是否满足要求(基础库 2.31.1 以下需要相同主体或关联主体)
|
||||
- 检查视频号内容是否仍然存在(未被删除)
|
||||
|
||||
### 6.2 功能不可用
|
||||
|
||||
- 确认当前环境是否为微信小程序环境
|
||||
- 检查微信小程序基础库版本是否满足要求
|
||||
- 对于内嵌打开,检查主体条件是否满足
|
||||
- 检查 `feedId` 等参数是否正确
|
||||
|
||||
### 6.3 关联失败
|
||||
|
||||
- 检查视频号是否已完成实名认证
|
||||
- 检查小程序是否已发布上线
|
||||
- 检查视频号名称或ID是否输入正确
|
||||
- 确认视频号管理员是否在24小时内确认关联邀请
|
||||
- 如超过24小时未确认,需要重新发送关联邀请
|
||||
|
||||
### 6.4 组件显示异常
|
||||
|
||||
- 检查传递给组件的数据格式是否正确
|
||||
- 确认图片资源是否可访问
|
||||
- 检查微信小程序基础库版本是否支持视频号API
|
||||
|
||||
### 6.5 样式问题
|
||||
|
||||
- 可通过组件的 `componentAngle`、`topAroundRadius`、`bottomAroundRadius` 等属性调整组件样式
|
||||
- 可通过 `componentBgColor` 属性调整组件背景颜色
|
||||
- 可通过 `font` 属性调整字体样式
|
||||
|
||||
### 6.6 环境兼容性问题
|
||||
|
||||
- 微信视频号API只能在微信小程序环境中使用
|
||||
- 在其他环境中,组件会显示但无法播放视频
|
||||
- 建议在非小程序环境中添加友好的提示信息
|
||||
|
||||
### 6.7 在uni-app中使用原生组件时,可能会遇到组件不显示的问题
|
||||
|
||||
在uni-app中使用原生组件时,可能会遇到组件不显示的问题。以下是已验证的解决方案:
|
||||
|
||||
#### 解决方案
|
||||
|
||||
**方法一:使用 `<native-component>` 包裹**
|
||||
|
||||
在 UniApp 中使用 `channel-video` 组件时,必须用 `<native-component>` 包裹以确保组件正确显示:
|
||||
|
||||
``` vue
|
||||
<template>
|
||||
<view>
|
||||
<!-- #ifdef MP-WEIXIN -->
|
||||
<native-component>
|
||||
<channel-video
|
||||
feed-id="{{feedId}}"
|
||||
finder-user-name="{{finderUserName}}"
|
||||
feed-token="{{feedToken}}"
|
||||
style="width: 100%; height: 320rpx;"
|
||||
></channel-video>
|
||||
</native-component>
|
||||
<!-- #endif -->
|
||||
</view>
|
||||
</template>
|
||||
```
|
||||
|
||||
**方法二:检查 `manifest.json` 配置**
|
||||
|
||||
确保在 `manifest.json` 文件中正确设置了 `usingComponents: true`,特别是在 `mp-weixin` 部分:
|
||||
|
||||
``` json
|
||||
"mp-weixin": {
|
||||
"appid": "你的小程序appid",
|
||||
"usingComponents": true,
|
||||
// 其他配置...
|
||||
}
|
||||
```
|
||||
|
||||
**方法三:检查微信小程序基础库版本**
|
||||
|
||||
确保微信小程序基础库版本满足要求:
|
||||
- 跳转打开视频号视频需要基础库版本 2.19.2 及以上
|
||||
- 内嵌视频号视频需要基础库版本 2.25.1 及以上
|
||||
|
||||
**方法四:检查参数是否正确**
|
||||
|
||||
确保传递给 `channel-video` 组件的参数正确:
|
||||
- `feedId`:视频号内容ID,必填
|
||||
- `finderUserName`:视频号ID,可选
|
||||
- `feedToken`:非同主体视频号视频的标识,可选(基础库 2.31.1+)
|
||||
|
||||
## 7. 示例代码
|
||||
|
||||
### 7.1 单个视频号示例
|
||||
|
||||
```javascript
|
||||
// 单个视频号数据
|
||||
const channelData = {
|
||||
channelName: "示例视频号",
|
||||
avatarUrl: "https://example.com/avatar.jpg",
|
||||
videoTitle: "这是一个示例视频",
|
||||
coverUrl: "https://example.com/cover.jpg",
|
||||
feedId: "v02004g10000c3f7l7j5u87l33n8f160",
|
||||
viewCount: 12345,
|
||||
showFollow: true,
|
||||
componentAngle: "round",
|
||||
topAroundRadius: 10,
|
||||
bottomAroundRadius: 10
|
||||
};
|
||||
```
|
||||
|
||||
### 7.2 视频号列表示例
|
||||
|
||||
```javascript
|
||||
// 视频号列表数据
|
||||
const channelListData = {
|
||||
list: [
|
||||
{
|
||||
channelName: "示例视频号1",
|
||||
coverUrl: "https://example.com/cover1.jpg",
|
||||
videoTitle: "这是示例视频1",
|
||||
feedId: "v02004g10000c3f7l7j5u87l33n8f160",
|
||||
viewCount: 12345
|
||||
},
|
||||
{
|
||||
channelName: "示例视频号2",
|
||||
coverUrl: "https://example.com/cover2.jpg",
|
||||
videoTitle: "这是示例视频2",
|
||||
feedId: "v02004g10000c3f7m7j5u87l33n8f161",
|
||||
viewCount: 67890
|
||||
}
|
||||
],
|
||||
rowCount: 2,
|
||||
showStyle: "fixed",
|
||||
font: {
|
||||
size: 14,
|
||||
weight: "normal",
|
||||
color: "#333"
|
||||
},
|
||||
componentBgColor: "#fff",
|
||||
componentAngle: "round",
|
||||
topAroundRadius: 10,
|
||||
bottomAroundRadius: 10
|
||||
};
|
||||
```
|
||||
|
||||
## 8. 总结
|
||||
|
||||
通过本文档提供的组件和配置指导,你可以在UniApp项目中轻松集成微信视频号功能,为用户提供更加丰富的内容体验。
|
||||
|
||||
如果在集成过程中遇到问题,请参考本文档的常见问题部分,或查阅微信官方文档获取更多帮助。
|
||||
165
docs/example/wechat-channel-demo.vue
Normal file
165
docs/example/wechat-channel-demo.vue
Normal file
@@ -0,0 +1,165 @@
|
||||
<template>
|
||||
<view class="wechat-channel-demo">
|
||||
<view class="demo-header">
|
||||
<text class="demo-title">微信视频号集成示例</text>
|
||||
</view>
|
||||
|
||||
<view class="demo-section">
|
||||
<view class="section-title">单个视频号</view>
|
||||
<diy-wechat-channel :value="channelData" />
|
||||
</view>
|
||||
|
||||
<view class="demo-section">
|
||||
<view class="section-title">视频号列表</view>
|
||||
<diy-wechat-channel-list :value="channelListData" />
|
||||
</view>
|
||||
|
||||
<view class="demo-section">
|
||||
<view class="section-title">使用说明</view>
|
||||
<view class="section-content">
|
||||
<view class="content-item">1. 确保微信小程序已开通视频号权限</view>
|
||||
<view class="content-item">2. 小程序需与视频号关联</view>
|
||||
<view class="content-item">3. 传递正确的feedId用于播放视频</view>
|
||||
<view class="content-item">4. 仅支持微信小程序环境</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import diyWechatChannel from '@/components-diy/diy-wechat-channel.vue'
|
||||
import diyWechatChannelList from '@/components-diy/diy-wechat-channel-list.vue'
|
||||
|
||||
export default {
|
||||
name: 'wechat-channel-demo',
|
||||
components: {
|
||||
diyWechatChannel,
|
||||
diyWechatChannelList
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 单个视频号数据
|
||||
channelData: {
|
||||
channelName: "示例视频号",
|
||||
avatarUrl: "https://via.placeholder.com/100",
|
||||
videoTitle: "这是一个示例视频,展示如何使用微信视频号组件",
|
||||
coverUrl: "https://via.placeholder.com/640x360",
|
||||
feedId: "v02004g10000c3f7l7j5u87l33n8f160",
|
||||
viewCount: 12345,
|
||||
showFollow: true,
|
||||
componentAngle: "round",
|
||||
topAroundRadius: 10,
|
||||
bottomAroundRadius: 10
|
||||
},
|
||||
// 视频号列表数据
|
||||
channelListData: {
|
||||
list: [
|
||||
{
|
||||
channelName: "示例视频号1",
|
||||
coverUrl: "https://via.placeholder.com/640x360",
|
||||
videoTitle: "这是示例视频1,展示如何使用微信视频号组件",
|
||||
feedId: "v02004g10000c3f7l7j5u87l33n8f160",
|
||||
viewCount: 12345
|
||||
},
|
||||
{
|
||||
channelName: "示例视频号2",
|
||||
coverUrl: "https://via.placeholder.com/640x360",
|
||||
videoTitle: "这是示例视频2,展示如何使用微信视频号组件",
|
||||
feedId: "v02004g10000c3f7m7j5u87l33n8f161",
|
||||
viewCount: 67890
|
||||
},
|
||||
{
|
||||
channelName: "示例视频号3",
|
||||
coverUrl: "https://via.placeholder.com/640x360",
|
||||
videoTitle: "这是示例视频3,展示如何使用微信视频号组件",
|
||||
feedId: "v02004g10000c3f7n7j5u87l33n8f162",
|
||||
viewCount: 98765
|
||||
},
|
||||
{
|
||||
channelName: "示例视频号4",
|
||||
coverUrl: "https://via.placeholder.com/640x360",
|
||||
videoTitle: "这是示例视频4,展示如何使用微信视频号组件",
|
||||
feedId: "v02004g10000c3f7o7j5u87l33n8f163",
|
||||
viewCount: 54321
|
||||
}
|
||||
],
|
||||
rowCount: 2,
|
||||
showStyle: "fixed",
|
||||
font: {
|
||||
size: 14,
|
||||
weight: "normal",
|
||||
color: "#333"
|
||||
},
|
||||
componentBgColor: "#fff",
|
||||
componentAngle: "round",
|
||||
topAroundRadius: 10,
|
||||
bottomAroundRadius: 10
|
||||
}
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
console.log('微信视频号示例页面加载');
|
||||
},
|
||||
methods: {
|
||||
// 可以在这里添加自定义方法
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.wechat-channel-demo {
|
||||
padding: 20rpx;
|
||||
background-color: #f5f5f5;
|
||||
}
|
||||
|
||||
.demo-header {
|
||||
text-align: center;
|
||||
padding: 40rpx 0;
|
||||
background-color: #fff;
|
||||
margin-bottom: 20rpx;
|
||||
border-radius: 12rpx;
|
||||
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.08);
|
||||
}
|
||||
|
||||
.demo-title {
|
||||
font-size: 32rpx;
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.demo-section {
|
||||
background-color: #fff;
|
||||
margin-bottom: 20rpx;
|
||||
border-radius: 12rpx;
|
||||
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.08);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.section-title {
|
||||
font-size: 28rpx;
|
||||
font-weight: 500;
|
||||
color: #333;
|
||||
padding: 20rpx;
|
||||
border-bottom: 1rpx solid #f0f0f0;
|
||||
}
|
||||
|
||||
.section-content {
|
||||
padding: 20rpx;
|
||||
}
|
||||
|
||||
.content-item {
|
||||
font-size: 24rpx;
|
||||
color: #666;
|
||||
margin-bottom: 12rpx;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
/* 组件样式调整 */
|
||||
.demo-section >>> .diy-wechat-channel {
|
||||
margin: 20rpx;
|
||||
}
|
||||
|
||||
.demo-section >>> .diy-wechat-channel-list {
|
||||
margin: 20rpx;
|
||||
}
|
||||
</style>
|
||||
@@ -19,5 +19,10 @@ export const lang = {
|
||||
currencySymbol: '¥',
|
||||
submit: 'Submit',
|
||||
searchTip: 'Please enter search keywords'
|
||||
}
|
||||
},
|
||||
|
||||
login: 'Login/Register',
|
||||
loginTips: 'Click to login and enjoy more exciting information',
|
||||
toLogin: 'Go to login',
|
||||
toGoodsCategoryPage: 'Go shopping',
|
||||
}
|
||||
|
||||
@@ -21,6 +21,10 @@ export const lang = {
|
||||
searchTip: '请输入搜索关键词'
|
||||
},
|
||||
|
||||
login: '登录/注册',
|
||||
loginTpis: '点击登录 享受更多精彩信息',
|
||||
toLogin: '去登录',
|
||||
toGoodsCategoryPage: '去逛逛',
|
||||
|
||||
waitpay: '待付款',
|
||||
waitsend: '待发货',
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
export const lang = {
|
||||
//title为每个页面的标题
|
||||
title: '退款',
|
||||
checkDetail: '查看详情',
|
||||
emptyTips: '暂无退款记录'
|
||||
}
|
||||
export const lang = {
|
||||
//title为每个页面的标题
|
||||
title: '售后',
|
||||
checkDetail: '查看详情',
|
||||
emptyTips: '暂无售后记录'
|
||||
}
|
||||
|
||||
@@ -137,10 +137,8 @@
|
||||
</uni-popup>
|
||||
</view>
|
||||
<hover-nav :need="true"></hover-nav>
|
||||
<!-- #ifdef MP-WEIXIN -->
|
||||
<!-- 小程序隐私协议 -->
|
||||
<!-- 隐私协议 -->
|
||||
<privacy-popup ref="privacyPopup"></privacy-popup>
|
||||
<!-- #endif -->
|
||||
<to-top v-if="showTop" @toTop="scrollToTopNative()"></to-top>
|
||||
<ns-login ref="login"></ns-login>
|
||||
</view>
|
||||
|
||||
@@ -65,7 +65,7 @@
|
||||
{{ parseFloat(item.member_price).toFixed(2).split('.')[0] }}
|
||||
<text class="unit price-style small">.{{
|
||||
parseFloat(item.member_price).toFixed(2).split('.')[1]
|
||||
}}</text>
|
||||
}}</text>
|
||||
<image :src="$util.img('public/uniapp/index/VIP.png')" />
|
||||
</view>
|
||||
</view>
|
||||
@@ -79,7 +79,7 @@
|
||||
}}
|
||||
<text class="unit price-style small">.{{
|
||||
parseFloat(item.discount_price).toFixed(2).split('.')[1]
|
||||
}}</text>
|
||||
}}</text>
|
||||
<image
|
||||
:src="$util.img('public/uniapp/index/discount.png')" />
|
||||
</view>
|
||||
@@ -95,7 +95,7 @@
|
||||
{{ parseFloat(item.member_price).toFixed(2).split('.')[0] }}
|
||||
<text class="unit price-style small">.{{
|
||||
parseFloat(item.member_price).toFixed(2).split('.')[1]
|
||||
}}</text>
|
||||
}}</text>
|
||||
<image :src="$util.img('public/uniapp/index/VIP.png')" />
|
||||
</view>
|
||||
</view>
|
||||
@@ -108,7 +108,7 @@
|
||||
{{ parseFloat(item.price).toFixed(2).split('.')[0] }}
|
||||
<text class="unit price-style small">.{{
|
||||
parseFloat(item.price).toFixed(2).split('.')[1]
|
||||
}}</text>
|
||||
}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
@@ -175,7 +175,7 @@
|
||||
}}
|
||||
<text class="unit price-style small">.{{
|
||||
parseFloat(goodsItem.member_price).toFixed(2).split('.')[1]
|
||||
}}</text>
|
||||
}}</text>
|
||||
<image :src="$util.img('public/uniapp/index/VIP.png')" />
|
||||
</template>
|
||||
<template v-else>
|
||||
@@ -185,7 +185,7 @@
|
||||
}}
|
||||
<text class="unit price-style small">.{{
|
||||
parseFloat(goodsItem.discount_price).toFixed(2).split('.')[1]
|
||||
}}</text>
|
||||
}}</text>
|
||||
</template>
|
||||
</text>
|
||||
</view>
|
||||
@@ -199,9 +199,12 @@
|
||||
</block>
|
||||
<block v-else>
|
||||
<view class="cart-empty">
|
||||
<ns-empty text="购物车为空" subText="赶紧去逛逛, 购买心仪的商品吧" :isIndex="Boolean(storeToken)"></ns-empty>
|
||||
<button type="primary" size="mini" class="button mini" v-if="!storeToken"
|
||||
@click="toLogin">去登录</button>
|
||||
<ns-empty text="购物车为空" subText="赶紧去逛逛, 购买心仪的商品吧" :isIndex="Boolean(storeToken)"
|
||||
:emptyBtn="{ text: $lang('toGoodsCategoryPage'), url: '/pages_goods/category' }"></ns-empty>
|
||||
<button type="primary" size="mini" class="button mini" v-if="!storeToken" @click="toLogin">{{
|
||||
$lang('toLogin')
|
||||
}}</button>
|
||||
|
||||
</view>
|
||||
</block>
|
||||
<ns-goods-recommend ref="goodrecommend" route="cart"></ns-goods-recommend>
|
||||
@@ -316,9 +319,9 @@
|
||||
<text class="unit price-font">{{ $lang('common.currencySymbol') }}</text>
|
||||
<block v-if="Object.keys(discount).length">
|
||||
<text class="value price-font">{{ parseFloat(discount.order_money).toFixed(2).split('.')[0]
|
||||
}}</text>
|
||||
}}</text>
|
||||
<text class="unit price-font">.{{ parseFloat(discount.order_money).toFixed(2).split('.')[1]
|
||||
}}</text>
|
||||
}}</text>
|
||||
</block>
|
||||
<block v-else>
|
||||
<text class="value price-font">{{ parseFloat(totalPrice).toFixed(2).split('.')[0] }}</text>
|
||||
|
||||
@@ -400,7 +400,7 @@
|
||||
.price {
|
||||
color: var(--price-color);
|
||||
color: #fff !important;
|
||||
font-size: 15rpx !important;
|
||||
font-size: 27rpx !important;
|
||||
font-weight: bold !important;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
import common from './common.js';
|
||||
|
||||
export default {
|
||||
mixins: [common],
|
||||
data() {
|
||||
return {
|
||||
cartData: [], // 购物车
|
||||
@@ -444,9 +447,6 @@ export default {
|
||||
// });
|
||||
}
|
||||
},
|
||||
toLogin() {
|
||||
this.$refs.login.open();
|
||||
},
|
||||
// 重置编辑状态
|
||||
resetEditStatus() {
|
||||
if (this.cartData.length) {
|
||||
|
||||
8
pages_goods/public/js/common.js
Normal file
8
pages_goods/public/js/common.js
Normal file
@@ -0,0 +1,8 @@
|
||||
export default {
|
||||
methods: {
|
||||
// 跳转至登录页
|
||||
toLogin() {
|
||||
this.$refs.login.open();
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -669,7 +669,7 @@ export default {
|
||||
this.getEvaluateConfig();
|
||||
this.getOrderData();
|
||||
} else {
|
||||
this.$util.redirectTo('/pages_tool/login/login', {
|
||||
this.$util.redirectTo(this.$util.LOGIN_PAGE_URL, {
|
||||
back: '/pages_order/detail?order_id=' + this.orderId + '&merchant_trade_no=' + this.merchantTradeNo
|
||||
});
|
||||
}
|
||||
|
||||
@@ -161,7 +161,7 @@ export default {
|
||||
if (this.storeToken) {
|
||||
this.getOrderData();
|
||||
} else {
|
||||
this.$util.redirectTo('/pages_tool/login/login', {
|
||||
this.$util.redirectTo(this.$util.LOGIN_PAGE_URL, {
|
||||
back: '/pages_order/detail_point?order_id=' + this.orderId
|
||||
});
|
||||
}
|
||||
|
||||
@@ -156,11 +156,12 @@
|
||||
<ns-payment ref="choosePaymentPopup"></ns-payment>
|
||||
<ns-payment ref="choosePaymentMergePopup"></ns-payment>
|
||||
|
||||
<ns-login ref="login"></ns-login>
|
||||
<loading-cover ref="loadingCover"></loading-cover>
|
||||
<!-- #ifdef MP -->
|
||||
</mescroll-uni>
|
||||
<!-- #endif -->
|
||||
|
||||
<ns-login ref="login"></ns-login>
|
||||
<loading-cover ref="loadingCover"></loading-cover>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@@ -207,7 +208,7 @@ export default {
|
||||
if (this.$refs.mescroll) this.$refs.mescroll.refresh();
|
||||
} else {
|
||||
this.$nextTick(() => {
|
||||
this.$refs.login.open('/pages_order/list?status=' + this.orderStatus);
|
||||
this.$refs?.login?.open('/pages_order/list?status=' + this.orderStatus, 'redirectTo');
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
@@ -196,7 +196,7 @@
|
||||
duration: 2000
|
||||
});
|
||||
setTimeout(() => {
|
||||
this.$util.redirectTo('/pages/index/index');
|
||||
this.$util.redirectTo(this.$util.INDEX_PAGE_URL);
|
||||
}, 2000);
|
||||
}
|
||||
},1000);
|
||||
@@ -213,7 +213,7 @@
|
||||
this.applyStatus();
|
||||
this.getSourceMemberInfo();
|
||||
} else {
|
||||
this.$util.redirectTo('/pages_tool/login/login', {
|
||||
this.$util.redirectTo(this.$util.LOGIN_PAGE_URL, {
|
||||
back: '/pages_promotion/fenxiao/apply'
|
||||
}, 'redirectTo');
|
||||
}
|
||||
@@ -261,7 +261,7 @@
|
||||
this.status = res.data.status;
|
||||
this.isSub = false;
|
||||
if (this.status == 2) {
|
||||
this.$util.redirectTo('/pages/member/index');
|
||||
this.$util.redirectTo(this.$util.MEMBER_PAGE_URL);
|
||||
}
|
||||
}
|
||||
this.$refs.loadingCover.hide();
|
||||
@@ -410,7 +410,7 @@
|
||||
if (options.from === 'navigateBack') {
|
||||
return false;
|
||||
}
|
||||
this.$util.redirectTo('/pages/member/index');
|
||||
this.$util.redirectTo(this.$util.MEMBER_PAGE_URL);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -40,7 +40,7 @@ export default {
|
||||
duration: 2000
|
||||
});
|
||||
setTimeout(() => {
|
||||
this.$util.redirectTo('/pages/index/index');
|
||||
this.$util.redirectTo(this.$util.INDEX_PAGE_URL);
|
||||
}, 2000);
|
||||
}
|
||||
}, 1000);
|
||||
|
||||
@@ -59,7 +59,7 @@ export default {
|
||||
duration: 2000
|
||||
});
|
||||
setTimeout(() => {
|
||||
this.$util.redirectTo('/pages/index/index');
|
||||
this.$util.redirectTo(this.$util.INDEX_PAGE_URL);
|
||||
}, 2000);
|
||||
}
|
||||
}, 1000);
|
||||
|
||||
@@ -307,7 +307,7 @@ export default {
|
||||
duration: 2000
|
||||
});
|
||||
setTimeout(() => {
|
||||
this.$util.redirectTo('/pages/index/index', {}, 'redirectTo');
|
||||
this.$util.redirectTo(this.$util.INDEX_PAGE_URL, {}, 'redirectTo');
|
||||
}, 2000);
|
||||
}
|
||||
}, 1000);
|
||||
@@ -348,7 +348,7 @@ export default {
|
||||
duration: 2000
|
||||
});
|
||||
setTimeout(() => {
|
||||
this.$util.redirectTo('/pages/member/index');
|
||||
this.$util.redirectTo(this.$util.MEMBER_PAGE_URL);
|
||||
}, 2000);
|
||||
}
|
||||
}
|
||||
@@ -367,7 +367,7 @@ export default {
|
||||
title: '当前分销商已冻结'
|
||||
});
|
||||
setTimeout(() => {
|
||||
this.$util.redirectTo('/pages/member/index');
|
||||
this.$util.redirectTo(this.$util.MEMBER_PAGE_URL);
|
||||
}, 2000);
|
||||
return;
|
||||
}
|
||||
@@ -457,7 +457,7 @@ export default {
|
||||
if (options.from === 'navigateBack') {
|
||||
return false;
|
||||
}
|
||||
this.$util.redirectTo('/pages/member/index', {}, 'reLaunch');
|
||||
this.$util.redirectTo(this.$util.MEMBER_PAGE_URL, {}, 'reLaunch');
|
||||
return true;
|
||||
},
|
||||
watch: {
|
||||
|
||||
@@ -213,7 +213,7 @@
|
||||
duration: 2000
|
||||
});
|
||||
setTimeout(() => {
|
||||
this.$util.redirectTo('/pages/index/index');
|
||||
this.$util.redirectTo(this.$util.INDEX_PAGE_URL);
|
||||
}, 2000);
|
||||
}
|
||||
},1000);
|
||||
@@ -224,7 +224,7 @@
|
||||
this.getFenxiaoInfo();
|
||||
this.getBasicsConfig();
|
||||
} else {
|
||||
this.$util.redirectTo('/pages_tool/login/login', {
|
||||
this.$util.redirectTo(this.$util.LOGIN_PAGE_URL, {
|
||||
back: '/pages_promotion/fenxiao/level'
|
||||
});
|
||||
}
|
||||
|
||||
@@ -142,7 +142,7 @@ export default {
|
||||
duration: 2000
|
||||
});
|
||||
setTimeout(() => {
|
||||
this.$util.redirectTo('/pages/index/index');
|
||||
this.$util.redirectTo(this.$util.INDEX_PAGE_URL);
|
||||
}, 2000);
|
||||
}
|
||||
}, 1000);
|
||||
|
||||
@@ -105,7 +105,7 @@ export default {
|
||||
duration: 2000
|
||||
});
|
||||
setTimeout(() => {
|
||||
this.$util.redirectTo('/pages/index/index');
|
||||
this.$util.redirectTo(this.$util.INDEX_PAGE_URL);
|
||||
}, 2000);
|
||||
}
|
||||
},1000);
|
||||
|
||||
@@ -84,7 +84,7 @@ export default {
|
||||
duration: 2000
|
||||
});
|
||||
setTimeout(() => {
|
||||
this.$util.redirectTo('/pages/index/index');
|
||||
this.$util.redirectTo(this.$util.INDEX_PAGE_URL);
|
||||
}, 2000);
|
||||
}
|
||||
}, 1000);
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
<ns-login ref="login"></ns-login>
|
||||
<loading-cover ref="loadingCover"></loading-cover>
|
||||
|
||||
<!-- 隐私弹窗 -->
|
||||
<!-- 隐私弹窗 -->
|
||||
<privacy-popup ref="privacyPopup"></privacy-popup>
|
||||
</view>
|
||||
</template>
|
||||
@@ -65,7 +65,7 @@ export default {
|
||||
this.$api.sendRequest({
|
||||
url: '/fenxiao/api/fenxiao/poster',
|
||||
data: {
|
||||
page: '/pages/index/index',
|
||||
page: this.$util.INDEX_PAGE_URL,
|
||||
qrcode_param: JSON.stringify({}),
|
||||
template_id: id
|
||||
},
|
||||
@@ -154,7 +154,7 @@ export default {
|
||||
duration: 2000
|
||||
});
|
||||
setTimeout(() => {
|
||||
this.$util.redirectTo('/pages/index/index');
|
||||
this.$util.redirectTo(this.$util.INDEX_PAGE_URL);
|
||||
}, 2000);
|
||||
}
|
||||
}, 1000);
|
||||
|
||||
@@ -27,7 +27,7 @@ export default {
|
||||
duration: 2000
|
||||
});
|
||||
setTimeout(() => {
|
||||
this.$util.redirectTo('/pages/index/index');
|
||||
this.$util.redirectTo(this.$util.INDEX_PAGE_URL);
|
||||
}, 2000);
|
||||
}
|
||||
}, 1000);
|
||||
@@ -40,7 +40,7 @@ export default {
|
||||
|
||||
if (!this.storeToken) {
|
||||
this.$util.redirectTo(
|
||||
'/pages_tool/login/login', {
|
||||
this.$util.LOGIN_PAGE_URL, {
|
||||
back: '/pages_promotion/fenxiao/goods_list'
|
||||
},
|
||||
'redirectTo'
|
||||
|
||||
@@ -113,7 +113,7 @@ export default {
|
||||
duration: 2000
|
||||
});
|
||||
setTimeout(() => {
|
||||
this.$util.redirectTo('/pages/index/index');
|
||||
this.$util.redirectTo(this.$util.INDEX_PAGE_URL);
|
||||
}, 2000);
|
||||
}
|
||||
}, 1000);
|
||||
|
||||
@@ -90,7 +90,7 @@
|
||||
this.getBankAccountInfo();
|
||||
this.getWithdrawInfo();
|
||||
} else {
|
||||
this.$util.redirectTo('/pages_tool/login/login', {
|
||||
this.$util.redirectTo(this.$util.LOGIN_PAGE_URL, {
|
||||
back: '/pages_promotion/fenxiao/withdraw_apply'
|
||||
});
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ export default {
|
||||
duration: 2000
|
||||
});
|
||||
setTimeout(() => {
|
||||
this.$util.redirectTo('/pages/index/index');
|
||||
this.$util.redirectTo(this.$util.INDEX_PAGE_URL);
|
||||
}, 2000);
|
||||
}
|
||||
}, 1000);
|
||||
|
||||
@@ -67,7 +67,7 @@ export default {
|
||||
if (this.storeToken) {
|
||||
this.getDetail();
|
||||
} else {
|
||||
this.$util.redirectTo('/pages_tool/login/login', {
|
||||
this.$util.redirectTo(this.$util.LOGIN_PAGE_URL, {
|
||||
back: '/pages_promotion/fenxiao/withdraw_list'
|
||||
}, 'redirectTo');
|
||||
}
|
||||
|
||||
@@ -302,7 +302,7 @@ export default {
|
||||
duration: 2000
|
||||
});
|
||||
setTimeout(() => {
|
||||
this.$util.redirectTo('/pages/index/index');
|
||||
this.$util.redirectTo(this.$util.INDEX_PAGE_URL);
|
||||
}, 2000);
|
||||
}
|
||||
}, 1000);
|
||||
@@ -544,7 +544,7 @@ export default {
|
||||
if (getCurrentPages().length > 1) uni.navigateBack({
|
||||
delta: 1
|
||||
});
|
||||
else this.$util.redirectTo('/pages/index/index');
|
||||
else this.$util.redirectTo(this.$util.INDEX_PAGE_URL);
|
||||
},
|
||||
getNewestGame() {
|
||||
this.$api.sendRequest({
|
||||
|
||||
@@ -120,7 +120,7 @@ export default {
|
||||
duration: 2000
|
||||
});
|
||||
setTimeout(() => {
|
||||
this.$util.redirectTo('/pages/index/index', {}, 'redirectTo');
|
||||
this.$util.redirectTo(this.$util.INDEX_PAGE_URL, {}, 'redirectTo');
|
||||
}, 2000);
|
||||
}
|
||||
}, 1000);
|
||||
|
||||
@@ -95,7 +95,7 @@ export default {
|
||||
title: '未获取到创建订单所需数据!'
|
||||
});
|
||||
setTimeout(() => {
|
||||
this.$util.redirectTo('/pages/index/index');
|
||||
this.$util.redirectTo(this.$util.INDEX_PAGE_URL);
|
||||
}, 1500);
|
||||
}
|
||||
return;
|
||||
@@ -122,7 +122,7 @@ export default {
|
||||
title: '未获取到创建订单所需数据!'
|
||||
});
|
||||
setTimeout(() => {
|
||||
this.$util.redirectTo('/pages/index/index');
|
||||
this.$util.redirectTo(this.$util.INDEX_PAGE_URL);
|
||||
}, 1500);
|
||||
}
|
||||
},
|
||||
@@ -547,7 +547,7 @@ export default {
|
||||
}
|
||||
// 判断登录
|
||||
if (!this.storeToken) {
|
||||
this.$util.redirectTo('/pages_tool/login/login');
|
||||
this.$util.redirectTo(this.$util.LOGIN_PAGE_URL);
|
||||
} else {
|
||||
this.getOrderPaymentData();
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
this.$util.redirectTo('/pages_promotion/point/order_list', {}, 'redirectTo');
|
||||
},
|
||||
toIndex() {
|
||||
this.$util.redirectTo('/pages/index/index');
|
||||
this.$util.redirectTo(this.$util.INDEX_PAGE_URL);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -99,7 +99,7 @@ export default {
|
||||
duration: 2000
|
||||
});
|
||||
setTimeout(() => {
|
||||
this.$util.redirectTo('/pages/index/index');
|
||||
this.$util.redirectTo(this.$util.INDEX_PAGE_URL);
|
||||
}, 2000);
|
||||
}
|
||||
}, 1000);
|
||||
|
||||
@@ -58,7 +58,7 @@
|
||||
duration: 2000
|
||||
});
|
||||
setTimeout(() => {
|
||||
this.$util.redirectTo('/pages/index/index');
|
||||
this.$util.redirectTo(this.$util.INDEX_PAGE_URL);
|
||||
}, 2000);
|
||||
}
|
||||
},1000);
|
||||
|
||||
@@ -128,7 +128,7 @@ export default {
|
||||
if (this.stepShow > 0) {
|
||||
this.stepShow -= 1;
|
||||
} else {
|
||||
this.$util.redirectTo('/pages_tool/login/login', '', 'redirectTo');
|
||||
this.$util.redirectTo(this.$util.LOGIN_PAGE_URL, '', 'redirectTo');
|
||||
}
|
||||
},
|
||||
// 下一步
|
||||
@@ -318,7 +318,7 @@ export default {
|
||||
uni.removeStorage({
|
||||
key: 'forgot_password_token'
|
||||
});
|
||||
this.$util.redirectTo('/pages_tool/login/login', {}, 'redirectTo');
|
||||
this.$util.redirectTo(this.$util.LOGIN_PAGE_URL, {}, 'redirectTo');
|
||||
}, 1000);
|
||||
} else {
|
||||
this.stepShow -= 1;
|
||||
|
||||
@@ -234,13 +234,13 @@ export default {
|
||||
this.$util.showToast({
|
||||
title: this.$lang('loginSuccessTip')
|
||||
});
|
||||
let back = this.back ? this.back : '/pages/member/index';
|
||||
let back = this.back ? this.back : this.$util.MEMBER_PAGE_URL;
|
||||
if (this.$refs.registerReward) this.$refs.registerReward.open(back);
|
||||
} else {
|
||||
if (this.back != '') {
|
||||
this.$util.redirectTo(decodeURIComponent(this.back), {}, 'reLaunch');
|
||||
} else {
|
||||
this.$util.redirectTo('/pages/member/index', {}, 'reLaunch');
|
||||
this.$util.redirectTo(this.$util.MEMBER_PAGE_URL, {}, 'reLaunch');
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -348,13 +348,13 @@ export default {
|
||||
this.$store.dispatch('getCartNumber');
|
||||
this.getMemberInfo(() => {
|
||||
if (can_receive_registergift == 1) {
|
||||
let back = this.back ? this.back : '/pages/member/index';
|
||||
let back = this.back ? this.back : this.$util.MEMBER_PAGE_URL;
|
||||
if (this.$refs.registerReward) this.$refs.registerReward.open(back);
|
||||
} else {
|
||||
if (this.back != '') {
|
||||
this.$util.redirectTo(decodeURIComponent(this.back), {}, this.redirect);
|
||||
} else {
|
||||
this.$util.redirectTo('/pages/member/index', {}, this.redirect);
|
||||
this.$util.redirectTo(this.$util.MEMBER_PAGE_URL, {}, this.redirect);
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@@ -78,7 +78,7 @@
|
||||
this.getWithdrawInfo();
|
||||
this.getBankAccountInfo();
|
||||
} else {
|
||||
this.$util.redirectTo('/pages_tool/login/login', {
|
||||
this.$util.redirectTo(this.$util.LOGIN_PAGE_URL, {
|
||||
back: '/pages_tool/member/apply_withdrawal'
|
||||
});
|
||||
}
|
||||
@@ -109,7 +109,7 @@
|
||||
title: '未开启提现'
|
||||
});
|
||||
setTimeout(() => {
|
||||
this.$util.redirectTo('/pages/member/index');
|
||||
this.$util.redirectTo(this.$util.MEMBER_PAGE_URL);
|
||||
}, 1500);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ export default {
|
||||
|
||||
// 判断登录
|
||||
if (!this.storeToken) {
|
||||
this.$util.redirectTo('/pages_tool/login/login');
|
||||
this.$util.redirectTo(this.$util.LOGIN_PAGE_URL);
|
||||
} else {
|
||||
this.getAccountInfo();
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
'height': menuButtonBounding.height + 'px'
|
||||
}">
|
||||
<view class="navbar-wrap">
|
||||
<text class="iconfont icon-back_light back" @click="$util.redirectTo('/pages/member/index')"></text>
|
||||
<text class="iconfont icon-back_light back" @click="$util.redirectTo($util.MEMBER_PAGE_URL)"></text>
|
||||
<view class="navbar-title">
|
||||
账户余额
|
||||
</view>
|
||||
@@ -171,7 +171,7 @@ export default {
|
||||
if (options.from === 'navigateBack') {
|
||||
return false;
|
||||
}
|
||||
this.$util.redirectTo('/pages/member/index', {}, 'reLaunch');
|
||||
this.$util.redirectTo(this.$util.MEMBER_PAGE_URL, {}, 'reLaunch');
|
||||
return true;
|
||||
},
|
||||
watch: {
|
||||
|
||||
@@ -31,7 +31,7 @@ export default {
|
||||
if (option.back) this.back = option.back;
|
||||
// 判断登录
|
||||
if (!this.storeToken) {
|
||||
this.$util.redirectTo('/pages_tool/login/login');
|
||||
this.$util.redirectTo(this.$util.LOGIN_PAGE_URL);
|
||||
} else {
|
||||
this.getCancelAgreement();
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ export default {
|
||||
|
||||
// 判断登录
|
||||
if (!this.storeToken) {
|
||||
this.$util.redirectTo('/pages_tool/login/login');
|
||||
this.$util.redirectTo(this.$util.LOGIN_PAGE_URL);
|
||||
} else {
|
||||
this.getStatus();
|
||||
}
|
||||
@@ -43,7 +43,7 @@ export default {
|
||||
});
|
||||
},
|
||||
toIndex() {
|
||||
this.$util.redirectTo('/pages/member/index');
|
||||
this.$util.redirectTo(this.$util.MEMBER_PAGE_URL);
|
||||
},
|
||||
apply() {
|
||||
this.$util.redirectTo('/pages_tool/member/cancellation');
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
onLoad(option) {
|
||||
// 判断登录
|
||||
if (!this.storeToken) {
|
||||
this.$util.redirectTo('/pages_tool/login/login');
|
||||
this.$util.redirectTo(this.$util.LOGIN_PAGE_URL);
|
||||
} else {
|
||||
this.getStatus();
|
||||
}
|
||||
@@ -71,13 +71,13 @@
|
||||
this.$store.commit('setMemberInfo', '');
|
||||
this.$store.commit('setMemberInfo', '');
|
||||
this.$store.dispatch('emptyCart');
|
||||
this.$util.redirectTo('/pages/index/index');
|
||||
this.$util.redirectTo(this.$util.INDEX_PAGE_URL);
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
back() {
|
||||
this.$util.redirectTo('/pages/member/index');
|
||||
this.$util.redirectTo(this.$util.MEMBER_PAGE_URL);
|
||||
},
|
||||
revoke() {
|
||||
uni.showModal({
|
||||
@@ -90,7 +90,7 @@
|
||||
url: '/membercancel/api/membercancel/cancelApply',
|
||||
success: res => {
|
||||
if (res.code >= 0) {
|
||||
this.$util.redirectTo('/pages/member/index');
|
||||
this.$util.redirectTo(this.$util.MEMBER_PAGE_URL);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
// 判断登录
|
||||
if (!this.storeToken) {
|
||||
this.$util.redirectTo('/pages_tool/login/login');
|
||||
this.$util.redirectTo(this.$util.LOGIN_PAGE_URL);
|
||||
} else {
|
||||
this.getStatus();
|
||||
}
|
||||
@@ -40,7 +40,7 @@
|
||||
this.$store.commit('setToken', '');
|
||||
this.$store.commit('setMemberInfo', '');
|
||||
this.$store.dispatch('emptyCart');
|
||||
this.$util.redirectTo('/pages/index/index');
|
||||
this.$util.redirectTo(this.$util.INDEX_PAGE_URL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -183,7 +183,7 @@ export default {
|
||||
if (options.from === 'navigateBack') {
|
||||
return false;
|
||||
}
|
||||
this.$util.redirectTo('/pages/member/index');
|
||||
this.$util.redirectTo(this.$util.MEMBER_PAGE_URL);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
@@ -220,7 +220,7 @@ export default {
|
||||
}
|
||||
</style>
|
||||
|
||||
<style scoped>
|
||||
<style lang="scss" scoped>
|
||||
/deep/ .sku-layer .uni-popup__wrapper.uni-custom .uni-popup__wrapper-box {
|
||||
max-height: unset !important;
|
||||
}
|
||||
|
||||
@@ -418,7 +418,7 @@ export default {
|
||||
if (options.from === 'navigateBack') {
|
||||
return false;
|
||||
}
|
||||
this.$util.redirectTo('/pages/member/index');
|
||||
this.$util.redirectTo(this.$util.MEMBER_PAGE_URL);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
<template>
|
||||
<view :style="themeColor">
|
||||
<mescroll-uni ref="mescroll" @getData="getData" class="member-point" :size="8" @listenRefresh="listenRefresh"
|
||||
v-if="storeToken">
|
||||
<view class="goods_list" slot="list">
|
||||
<mescroll-uni ref="mescroll" @getData="getData" class="member-point" :size="8" @listenRefresh="listenRefresh">
|
||||
<block class="goods_list" slot="list">
|
||||
<block v-if="collectionList.length > 0">
|
||||
<view class="goods_li margin-top" v-for="(item, index) in collectionList" :key="index"
|
||||
@click.stop="toDetail(item)">
|
||||
@@ -30,9 +29,15 @@
|
||||
</view>
|
||||
</block>
|
||||
<!-- 第一个列表为空时 -->
|
||||
<ns-empty v-if="collectionList.length == 0 && isShowEmpty" text="暂无关注的商品" :isIndex="false"></ns-empty>
|
||||
<view class="collection-empty" v-else>
|
||||
<ns-empty v-if="collectionList.length == 0 && isShowEmpty" text="暂无关注的商品" subText="赶紧去逛逛, 关注心仪的商品吧"
|
||||
:isIndex="Boolean(storeToken)" :emptyBtn="{ text: $lang('toGoodsCategoryPage'), url: '/pages_goods/category' }"></ns-empty>
|
||||
<button type="primary" size="mini" class="button mini" v-if="!storeToken"
|
||||
@click="toLogin">{{ $lang('toLogin') }}</button>
|
||||
</view>
|
||||
|
||||
<ns-goods-recommend ref="goodsRecommend"></ns-goods-recommend>
|
||||
</view>
|
||||
</block>
|
||||
</mescroll-uni>
|
||||
<ns-login ref="login"></ns-login>
|
||||
<loading-cover ref="loadingCover"></loading-cover>
|
||||
@@ -40,11 +45,11 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import common from './public/js/common.js';
|
||||
import collection from './public/js/collection.js';
|
||||
|
||||
export default {
|
||||
mixins: [collection],
|
||||
mixins: [common, collection],
|
||||
data() {
|
||||
return {};
|
||||
},
|
||||
@@ -53,7 +58,7 @@ export default {
|
||||
if (this.$refs.mescroll) this.$refs.mescroll.refresh();
|
||||
} else {
|
||||
this.$nextTick(() => {
|
||||
this.$refs.login.open('/pages_tool/member/collection');
|
||||
this.$refs.loadingCover.hide();
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
@@ -60,7 +60,7 @@
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="!list.length && showEmpty" class="margin-top cart-empty" :fixed="false">
|
||||
<ns-empty :isIndex="true" :emptyBtn="{url: '/pages/index/index',text: '去逛逛'}" text="暂无优惠券"></ns-empty>
|
||||
<ns-empty :isIndex="true" :emptyBtn="{url: $util.INDEX_PAGE_URL,text: '去逛逛'}" text="暂无优惠券"></ns-empty>
|
||||
</view>
|
||||
</block>
|
||||
</mescroll-uni>
|
||||
@@ -93,7 +93,7 @@ export default {
|
||||
duration: 2000
|
||||
});
|
||||
setTimeout(() => {
|
||||
this.$util.redirectTo('/pages/index/index');
|
||||
this.$util.redirectTo(this.$util.INDEX_PAGE_URL);
|
||||
}, 2000);
|
||||
}
|
||||
},1000);
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
<view class="head-wrap" v-if="storeToken">
|
||||
<text @click="manageFootprint">{{ manage ? '完成' : '管理' }}</text>
|
||||
</view>
|
||||
<mescroll-uni ref="mescroll" @getData="getListData" top="110rpx" v-if="storeToken">
|
||||
<mescroll-uni ref="mescroll" @getData="getListData" top="110rpx">
|
||||
<block slot="list">
|
||||
<view class="goods-list single-column" v-if="goodsList.length">
|
||||
<view class="goods-list single-column" v-if="goodsList.length > 0">
|
||||
<view v-for="(item, index) in goodsList" :key="index">
|
||||
<view class="datetime">{{ datetime(item) }}</view>
|
||||
<view class="goods-item" :class="{ manage: manage }">
|
||||
@@ -45,7 +45,11 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-else><ns-empty text="暂无浏览过的商品"></ns-empty></view>
|
||||
<view class="footprint-empty" v-else>
|
||||
<ns-empty text="暂无浏览过的商品" subText="赶紧去逛逛, 发现更多商品吧" :isIndex="Boolean(storeToken)" :emptyBtn="{ text: $lang('toGoodsCategoryPage'), url: '/pages_goods/category' }"></ns-empty>
|
||||
<button type="primary" size="mini" class="button mini" v-if="!storeToken"
|
||||
@click="toLogin">{{ $lang('toLogin') }}</button>
|
||||
</view>
|
||||
|
||||
<view class="bottom-wrap" v-if="goodsList.length && manage">
|
||||
<view class="all-election" @click="allElection">
|
||||
@@ -65,7 +69,10 @@
|
||||
<script>
|
||||
var dateList = [];
|
||||
|
||||
import common from './public/js/common.js';
|
||||
|
||||
export default {
|
||||
mixins: [common],
|
||||
data() {
|
||||
return {
|
||||
goodsList: [],
|
||||
@@ -81,7 +88,7 @@ export default {
|
||||
if (this.$refs.mescroll) this.$refs.mescroll.refresh();
|
||||
} else {
|
||||
this.$nextTick(() => {
|
||||
this.$refs.login.open('/pages_tool/member/footprint');
|
||||
this.$refs.loadingCover.hide();
|
||||
});
|
||||
}
|
||||
},
|
||||
@@ -108,9 +115,7 @@ export default {
|
||||
if (res.code == 0 && res.data) {
|
||||
newArr = res.data.list;
|
||||
} else {
|
||||
this.$util.showToast({
|
||||
title: msg
|
||||
});
|
||||
console.log(`后台服务器返回的信息:${msg}`);
|
||||
}
|
||||
mescroll.endSuccess(newArr.length);
|
||||
//设置列表数据
|
||||
|
||||
@@ -96,7 +96,8 @@ export default {
|
||||
this.$store.commit('setMemberInfo', '');
|
||||
this.$store.dispatch('emptyCart');
|
||||
uni.removeStorageSync('authInfo');
|
||||
this.$util.redirectTo('/pages/member/index');
|
||||
uni.removeStorageSync('privacyAgreed');
|
||||
this.$util.redirectTo(this.$util.MEMBER_PAGE_URL);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -118,7 +119,9 @@ export default {
|
||||
this.$store.commit('setMemberInfo', '');
|
||||
this.$store.dispatch('emptyCart');
|
||||
uni.removeStorageSync('authInfo');
|
||||
this.$util.redirectTo('/pages/member/index');
|
||||
uni.removeStorageSync('privacyAgreed');
|
||||
this.$util.redirectTo(this.$util.MEMBER_PAGE_URL);
|
||||
|
||||
} else {
|
||||
this.$util.showToast({
|
||||
title: rres.message
|
||||
|
||||
@@ -354,7 +354,7 @@
|
||||
if (options.from === 'navigateBack') {
|
||||
return false;
|
||||
}
|
||||
this.$util.redirectTo('/pages/member/index');
|
||||
this.$util.redirectTo(this.$util.MEMBER_PAGE_URL);
|
||||
return true;
|
||||
},
|
||||
watch: {
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
onShow() {
|
||||
if (!this.storeToken) {
|
||||
this.$util.redirectTo(
|
||||
'/pages_tool/login/login', {
|
||||
this.$util.LOGIN_PAGE_URL, {
|
||||
back: '/pages_tool/member/modify_face'
|
||||
},
|
||||
'redirectTo'
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
|
||||
// 判断登录
|
||||
if (!this.storeToken) {
|
||||
this.$util.redirectTo('/pages_tool/login/login');
|
||||
this.$util.redirectTo(this.$util.LOGIN_PAGE_URL);
|
||||
} else {
|
||||
if (this.memberInfo.mobile == '') {
|
||||
uni.showModal({
|
||||
@@ -54,7 +54,7 @@
|
||||
}, 'redirectTo');
|
||||
} else {
|
||||
if (this.back) this.$util.redirectTo(this.back);
|
||||
else this.$util.redirectTo('/pages/member/index');
|
||||
else this.$util.redirectTo(this.$util.MEMBER_PAGE_URL);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -133,7 +133,7 @@
|
||||
setTimeout(() => {
|
||||
if (this.back) this.$util.redirectTo(this.back, {},
|
||||
'redirectTo');
|
||||
else this.$util.redirectTo('/pages/member/index');
|
||||
else this.$util.redirectTo(this.$util.MEMBER_PAGE_URL);
|
||||
}, 2000);
|
||||
} else {
|
||||
this.initInfo();
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
}"
|
||||
>
|
||||
<view class="navbar-wrap">
|
||||
<text class="iconfont icon-back_light back" @click="$util.redirectTo('/pages/member/index')"></text>
|
||||
<text class="iconfont icon-back_light back" @click="$util.redirectTo($util.MEMBER_PAGE_URL)"></text>
|
||||
<view class="navbar-title">
|
||||
我的积分
|
||||
</view>
|
||||
@@ -143,7 +143,7 @@ export default {
|
||||
if (options.from === 'navigateBack') {
|
||||
return false;
|
||||
}
|
||||
this.$util.redirectTo('/pages/member/index', {}, 'reLaunch');
|
||||
this.$util.redirectTo(this.$util.MEMBER_PAGE_URL, {}, 'reLaunch');
|
||||
return true;
|
||||
},
|
||||
watch: {
|
||||
|
||||
@@ -74,7 +74,7 @@ export default {
|
||||
onShow() {
|
||||
if (!this.storeToken) {
|
||||
this.$util.redirectTo(
|
||||
'/pages_tool/login/login',
|
||||
this.$util.LOGIN_PAGE_URL,
|
||||
{
|
||||
back: '/pages_tool/member/point'
|
||||
},
|
||||
|
||||
@@ -99,3 +99,24 @@
|
||||
box-sizing: border-box;
|
||||
margin-top: 50rpx;
|
||||
}
|
||||
|
||||
.collection-empty {
|
||||
text-align: center;
|
||||
padding: 140rpx $padding 80rpx $padding;
|
||||
|
||||
image {
|
||||
width: 380rpx;
|
||||
}
|
||||
|
||||
button {
|
||||
min-width: 300rpx;
|
||||
margin-top: 100rpx;
|
||||
height: 70rpx;
|
||||
line-height: 70rpx !important;
|
||||
font-size: $font-size-base;
|
||||
border-radius: 50rpx;
|
||||
&.visit-the {
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,27 @@
|
||||
margin-top: 100rpx;
|
||||
}
|
||||
|
||||
.footprint-empty {
|
||||
text-align: center;
|
||||
padding: 140rpx $padding 80rpx $padding;
|
||||
|
||||
image {
|
||||
width: 380rpx;
|
||||
}
|
||||
|
||||
button {
|
||||
min-width: 300rpx;
|
||||
margin-top: 100rpx;
|
||||
height: 70rpx;
|
||||
line-height: 70rpx !important;
|
||||
font-size: $font-size-base;
|
||||
border-radius: 50rpx;
|
||||
&.visit-the {
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.lineheight-clear {
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ export default {
|
||||
},
|
||||
async: false,
|
||||
}).then((res) => {
|
||||
let newArr = res.data.list;
|
||||
let newArr = res.data?.list || [];
|
||||
for (var i = 0; i < newArr.length; i++) {
|
||||
newArr[i].composite_score = Math.floor((parseFloat(newArr[i].shop_desccredit) + parseFloat(newArr[i].shop_servicecredit) + parseFloat(newArr[i].shop_deliverycredit)) / 3).toFixed(1);
|
||||
}
|
||||
|
||||
9
pages_tool/member/public/js/common.js
Normal file
9
pages_tool/member/public/js/common.js
Normal file
@@ -0,0 +1,9 @@
|
||||
export default {
|
||||
methods: {
|
||||
// 跳转至登录页
|
||||
toLogin(url) {
|
||||
console.log('跳转至登录页', {url, currentRoute: this.$util.getCurrentRoute()});
|
||||
this.$refs.login.open(url ?? this.$util.getCurrentRoute());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -256,7 +256,7 @@ export default {
|
||||
this.$store.dispatch('emptyCart');
|
||||
this.$store.dispatch('emptyCart');
|
||||
uni.removeStorageSync('authInfo');
|
||||
this.$util.redirectTo('/pages/member/index');
|
||||
this.$util.redirectTo(this.$util.MEMBER_PAGE_URL);
|
||||
} else {
|
||||
this.$util.showToast({
|
||||
title: rres.message
|
||||
@@ -329,7 +329,7 @@ export default {
|
||||
this.$store.dispatch('emptyCart');
|
||||
this.$store.dispatch('emptyCart');
|
||||
uni.removeStorageSync('authInfo');
|
||||
this.$util.redirectTo('/pages/member/index');
|
||||
this.$util.redirectTo(this.$util.MEMBER_PAGE_URL);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -51,7 +51,7 @@ export default {
|
||||
this.$refs.rulePopup.close();
|
||||
},
|
||||
copyUrl() {
|
||||
let text = this.$config.h5Domain + '/pages/index/index';
|
||||
let text = this.$config.h5Domain + this.$util.INDEX_PAGE_URL;
|
||||
if (this.memberInf && this.memberInfo.member_id) text += '?source_member=' + this.memberInfo.member_id;
|
||||
this.$util.copy(text, () => {
|
||||
this.closeSharePopup();
|
||||
@@ -76,7 +76,7 @@ export default {
|
||||
this.$api.sendRequest({
|
||||
url: "/memberrecommend/api/memberrecommend/poster",
|
||||
data: {
|
||||
page: '/pages/index/index',
|
||||
page: this.$util.INDEX_PAGE_URL,
|
||||
qrcode_param: JSON.stringify(qrcode_param)
|
||||
},
|
||||
success: res => {
|
||||
|
||||
@@ -33,7 +33,7 @@ export default {
|
||||
duration: 2000
|
||||
});
|
||||
setTimeout(() => {
|
||||
this.$util.redirectTo('/pages/index/index');
|
||||
this.$util.redirectTo(this.$util.INDEX_PAGE_URL);
|
||||
}, 2000);
|
||||
}
|
||||
},1000);
|
||||
@@ -106,7 +106,7 @@ export default {
|
||||
if (this.back != '') {
|
||||
this.$util.redirectTo(this.back, {}, this.redirect);
|
||||
} else {
|
||||
this.$util.redirectTo('/pages/member/index');
|
||||
this.$util.redirectTo(this.$util.MEMBER_PAGE_URL);
|
||||
}
|
||||
},
|
||||
//获取rule
|
||||
|
||||
@@ -40,7 +40,7 @@ export default {
|
||||
onShow() {
|
||||
if (!this.storeToken) {
|
||||
this.$util.redirectTo(
|
||||
'/pages_tool/login/login',
|
||||
this.$util.LOGIN_PAGE_URL,
|
||||
{
|
||||
back: '/pages_tool/member/point'
|
||||
},
|
||||
|
||||
@@ -69,7 +69,7 @@ export default {
|
||||
this.getDetail();
|
||||
} else {
|
||||
this.$util.redirectTo(
|
||||
'/pages_tool/login/login',
|
||||
this.$util.LOGIN_PAGE_URL,
|
||||
{
|
||||
back: '/pages_tool/member/point'
|
||||
},
|
||||
|
||||
@@ -91,7 +91,7 @@ export default {
|
||||
onShow() {
|
||||
// 判断登录
|
||||
if (!this.storeToken) {
|
||||
this.$util.redirectTo('/pages_tool/login/login');
|
||||
this.$util.redirectTo(this.$util.LOGIN_PAGE_URL);
|
||||
} else {
|
||||
this.getPackageInfo();
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ export default {
|
||||
|
||||
this.isIphoneX = this.$util.uniappIsIPhoneX();
|
||||
if (!this.storeToken) {
|
||||
this.$util.redirectTo('/pages_tool/login/login', {
|
||||
this.$util.redirectTo(this.$util.LOGIN_PAGE_URL, {
|
||||
back: '/pages_tool/order/evaluate?order_id=' + this.orderId
|
||||
}, 'redirectTo');
|
||||
}
|
||||
|
||||
@@ -130,7 +130,7 @@ export default {
|
||||
if (this.storeToken) {
|
||||
this.getRefundData();
|
||||
} else {
|
||||
this.$util.redirectTo('/pages_tool/login/login', { back: '/pages_tool/order/refund?order_goods_id=' + this.order_goods_id });
|
||||
this.$util.redirectTo(this.$util.LOGIN_PAGE_URL, { back: '/pages_tool/order/refund?order_goods_id=' + this.order_goods_id });
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
||||
@@ -122,7 +122,7 @@ export default {
|
||||
if (this.storeToken) {
|
||||
this.getRefundData();
|
||||
} else {
|
||||
this.$util.redirectTo('/pages_tool/login/login', { back: '/pages_tool/order/refund?order_goods_id=' + this.order_goods_id });
|
||||
this.$util.redirectTo(this.$util.LOGIN_PAGE_URL, { back: '/pages_tool/order/refund?order_goods_id=' + this.order_goods_id });
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
||||
@@ -175,7 +175,7 @@ export default {
|
||||
if (this.storeToken) {
|
||||
this.getRefundDetail();
|
||||
} else {
|
||||
this.$util.redirectTo('/pages_tool/login/login', { back: '/pages_tool/order/refund_detail?order_goods_id=' + this.order_goods_id });
|
||||
this.$util.redirectTo(this.$util.LOGIN_PAGE_URL, { back: '/pages_tool/order/refund_detail?order_goods_id=' + this.order_goods_id });
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
if (this.storeToken) {
|
||||
this.getRefundData();
|
||||
} else {
|
||||
this.$util.redirectTo('/pages_tool/login/login', {
|
||||
this.$util.redirectTo(this.$util.LOGIN_PAGE_URL, {
|
||||
back: '/pages_tool/order/refund?order_goods_id=' + this.order_goods_id
|
||||
});
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ export default {
|
||||
onShow() {
|
||||
|
||||
if (!this.storeToken) {
|
||||
this.$util.redirectTo('/pages_tool/login/login');
|
||||
this.$util.redirectTo(this.$util.LOGIN_PAGE_URL);
|
||||
} else {
|
||||
this.getPayInfo();
|
||||
}
|
||||
@@ -54,7 +54,7 @@ export default {
|
||||
title: '未获取到支付信息!'
|
||||
});
|
||||
setTimeout(() => {
|
||||
this.$util.redirectTo('/pages/index/index');
|
||||
this.$util.redirectTo(this.$util.INDEX_PAGE_URL);
|
||||
}, 1500);
|
||||
}
|
||||
},
|
||||
|
||||
@@ -91,7 +91,7 @@
|
||||
this.$util.redirectTo('/pages_tool/member/coupon', {});
|
||||
break;
|
||||
default:
|
||||
this.$util.redirectTo('/pages/member/index', {}, 'reLaunch');
|
||||
this.$util.redirectTo(this.$util.MEMBER_PAGE_URL, {}, 'reLaunch');
|
||||
break;
|
||||
}
|
||||
},
|
||||
@@ -133,7 +133,7 @@
|
||||
title: '未获取到支付信息!'
|
||||
});
|
||||
setTimeout(() => {
|
||||
this.$util.redirectTo('/pages/index/index', {}, 'reLaunch');
|
||||
this.$util.redirectTo(this.$util.INDEX_PAGE_URL, {}, 'reLaunch');
|
||||
}, 1500);
|
||||
}
|
||||
},
|
||||
@@ -143,7 +143,7 @@
|
||||
});
|
||||
},
|
||||
goHome() {
|
||||
this.$util.redirectTo('/pages/index/index', {}, 'reLaunch');
|
||||
this.$util.redirectTo(this.$util.INDEX_PAGE_URL, {}, 'reLaunch');
|
||||
},
|
||||
toOrderDetail(id) {
|
||||
if (this.payInfo.order_type == 2) {
|
||||
|
||||
@@ -30,7 +30,7 @@ export default {
|
||||
data: {},
|
||||
success: res => {
|
||||
if (res.code == 0) {
|
||||
this.$util.redirectTo('/pages/index/index');
|
||||
this.$util.redirectTo(this.$util.INDEX_PAGE_URL);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
62
scripts/clean-empty-directories.js
Normal file
62
scripts/clean-empty-directories.js
Normal file
@@ -0,0 +1,62 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
/**
|
||||
* 递归删除空目录
|
||||
* @param {string} dirPath - 要检查的目录路径
|
||||
* @param {boolean} dryRun - 是否只打印不删除
|
||||
*/
|
||||
function removeEmptyDirectories(dirPath, dryRun = false) {
|
||||
try {
|
||||
// 读取目录内容
|
||||
const files = fs.readdirSync(dirPath);
|
||||
|
||||
// 递归检查子目录
|
||||
for (const file of files) {
|
||||
const fullPath = path.join(dirPath, file);
|
||||
const stat = fs.statSync(fullPath);
|
||||
|
||||
if (stat.isDirectory()) {
|
||||
removeEmptyDirectories(fullPath, dryRun);
|
||||
}
|
||||
}
|
||||
|
||||
// 再次读取目录内容,因为子目录可能已经被删除
|
||||
const updatedFiles = fs.readdirSync(dirPath);
|
||||
|
||||
// 如果目录为空
|
||||
if (updatedFiles.length === 0) {
|
||||
console.log(`${dryRun ? 'Would remove' : 'Removing'} empty directory: ${dirPath}`);
|
||||
if (!dryRun) {
|
||||
fs.rmdirSync(dirPath);
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(`Error processing directory ${dirPath}:`, error.message);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 主函数
|
||||
*/
|
||||
function main() {
|
||||
// 获取项目根目录
|
||||
const projectRoot = path.resolve(__dirname, '..');
|
||||
|
||||
console.log('Starting to remove empty directories...');
|
||||
console.log(`Project root: ${projectRoot}`);
|
||||
console.log('====================================');
|
||||
|
||||
// 执行删除操作
|
||||
removeEmptyDirectories(projectRoot);
|
||||
|
||||
console.log('====================================');
|
||||
console.log('Empty directory cleanup completed!');
|
||||
}
|
||||
|
||||
// 运行主函数
|
||||
if (require.main === module) {
|
||||
main();
|
||||
}
|
||||
|
||||
module.exports = removeEmptyDirectories;
|
||||
Reference in New Issue
Block a user