jd coupon
21
.gitignore
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
.DS_Store
|
||||
node_modules
|
||||
/dist
|
||||
|
||||
# local env files
|
||||
.env.local
|
||||
.env.*.local
|
||||
|
||||
# Log files
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
|
||||
# Editor directories and files
|
||||
.idea
|
||||
.vscode
|
||||
*.suo
|
||||
*.ntvs*
|
||||
*.njsproj
|
||||
*.sln
|
||||
*.sw?
|
84
app.js
Normal file
@ -0,0 +1,84 @@
|
||||
//app.js
|
||||
const i18n = require('./utils/language/i18n');
|
||||
const en = require('./utils/language/en');
|
||||
const zh_cn = require('./utils/language/zhCN');
|
||||
const {options} = require('./utils/network/services/service.js')
|
||||
const constants = require('./utils/constants')
|
||||
const util = require('./utils/util')
|
||||
|
||||
App({
|
||||
onLaunch: function () {
|
||||
|
||||
//国际化
|
||||
i18n.registerLocale({en, zh_cn});
|
||||
|
||||
//获取系统信息
|
||||
var sysinfo = wx.getSystemInfoSync();
|
||||
var language = sysinfo.language;
|
||||
if (language.toLowerCase() == "zh_cn" || language.toLowerCase() == "zh") language = "zh_cn";
|
||||
this.globalData.sys_info = sysinfo;
|
||||
this.globalData.sys_platform = sysinfo.platform;
|
||||
this.globalData.sys_language = language;
|
||||
this.i18n.setLocale(language);
|
||||
|
||||
// 获取用户信息
|
||||
wx.getSetting({
|
||||
success: res => {
|
||||
if (res.authSetting['scope.userInfo']) {
|
||||
// 已经授权,可以直接调用 getUserInfo 获取头像昵称,不会弹框
|
||||
wx.getUserInfo({
|
||||
success: res => {
|
||||
// 可以将 res 发送给后台解码出 unionId
|
||||
this.globalData.userInfo = res.userInfo
|
||||
// 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
|
||||
// 所以此处加入 callback 以防止这种情况
|
||||
if (this.userInfoReadyCallback) {
|
||||
this.userInfoReadyCallback(res)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
wx.getSystemInfo({
|
||||
success: e => {
|
||||
this.globalData.StatusBar = e.statusBarHeight;
|
||||
let custom = wx.getMenuButtonBoundingClientRect();
|
||||
this.globalData.Custom = custom;
|
||||
this.globalData.CustomBar = custom.bottom + custom.top - e.statusBarHeight;
|
||||
this.globalData.windowWidth = e.windowWidth
|
||||
this.globalData.windowHeight = e.windowHeight
|
||||
}
|
||||
})
|
||||
this.globalData.loginMode = util.getStorage(constants.NEW_USER_PLOY)
|
||||
//获取系统配置信息
|
||||
options().then(res => {
|
||||
let loginModel = false
|
||||
res.data.data.forEach(it => {
|
||||
if (it.key == 'app_force_login') loginModel = it.value
|
||||
})
|
||||
util.setStorage(constants.NEW_USER_PLOY, loginModel)
|
||||
util.setStorage(constants.DICTIONARY, res.data.data)
|
||||
this.globalData.loginMode = util.getStorage(constants.NEW_USER_PLOY)
|
||||
})
|
||||
|
||||
},
|
||||
|
||||
i18n,
|
||||
globalData: {
|
||||
userInfo: null,
|
||||
StatusBar: null,
|
||||
Custom: null,
|
||||
CustomBar: null,
|
||||
sys_language: "zh_cn",
|
||||
sys_platform: "ios",
|
||||
sys_info: null,
|
||||
windowHeight: 0,//窗口高度
|
||||
windowWidth: 0,//窗口宽度
|
||||
loginStatus: false,//是否已经登录
|
||||
loginMode: false,//新用户是否强制注册
|
||||
shareUrl:''
|
||||
}
|
||||
})
|
118
app.json
Normal file
@ -0,0 +1,118 @@
|
||||
{
|
||||
"pages": [
|
||||
"pages/main-two/main-two",
|
||||
"pages/daren/daren",
|
||||
"pages/vip/vip",
|
||||
"pages/strategy/strategy",
|
||||
"pages/mine/mine",
|
||||
"pages/launch/launch",
|
||||
"pages/sort/sort",
|
||||
"pages/product/product",
|
||||
"pages/login/login",
|
||||
"pages/login/phone-login/phone-login"
|
||||
],
|
||||
"subpackages": [
|
||||
{
|
||||
"root": "page_package",
|
||||
"name": "features",
|
||||
"pages": [
|
||||
"details/index",
|
||||
"search/search",
|
||||
"product-type/product-type",
|
||||
"video-play/video-play",
|
||||
"about/about",
|
||||
"menu-product/menu-product",
|
||||
"time-reward/time-reward",
|
||||
"new-welfare/new-welfare",
|
||||
"activity/activity",
|
||||
"money/cash/cash",
|
||||
"money/quota/quota",
|
||||
"money/history/history",
|
||||
"money/bill/bill",
|
||||
"money/explain/explain",
|
||||
"fans/fans",
|
||||
"equity/equity",
|
||||
"apply-vip/apply-vip",
|
||||
"profit/profit",
|
||||
"order/order",
|
||||
"video-course/video-course",
|
||||
"study/study",
|
||||
"question/question",
|
||||
"contacts/contacts",
|
||||
"feedback/feedback",
|
||||
"apply-vip/example/example",
|
||||
"poster/poster",
|
||||
"news-details/news-details",
|
||||
"transfer/transfer/transfer",
|
||||
"transfer/chain/chain"
|
||||
]
|
||||
}
|
||||
],
|
||||
"preloadRule": {
|
||||
"pages/launch/launch": {
|
||||
"network": "all",
|
||||
"packages": [
|
||||
"page_package"
|
||||
]
|
||||
}
|
||||
},
|
||||
"window": {
|
||||
"navigationBarBackgroundColor": "#F1444C",
|
||||
"navigationBarTitleText": "尚橙优选",
|
||||
"navigationBarTextStyle": "white"
|
||||
},
|
||||
"tabBar": {
|
||||
"custom": true,
|
||||
"color": "#7A7E83",
|
||||
"selectedColor": "#f43f3b",
|
||||
"borderStyle": "black",
|
||||
"backgroundColor": "#ffffff",
|
||||
"list": [
|
||||
{
|
||||
"pagePath": "pages/main-two/main-two",
|
||||
"iconPath": "images/ic_tab_home.png",
|
||||
"selectedIconPath": "images/ic_tab_home_cur.png",
|
||||
"text": "首页"
|
||||
},
|
||||
{
|
||||
"pagePath": "pages/sort/sort",
|
||||
"iconPath": "images/ic_tab_daren.png",
|
||||
"selectedIconPath": "images/ic_tab_daren_cur.png",
|
||||
"text": "分类"
|
||||
},
|
||||
{
|
||||
"pagePath": "pages/vip/vip",
|
||||
"iconPath": "images/ic_tab_vip.png",
|
||||
"selectedIconPath": "images/ic_tab_vip_cur.png",
|
||||
"text": "会员"
|
||||
},
|
||||
{
|
||||
"pagePath": "pages/strategy/strategy",
|
||||
"iconPath": "images/ic_tab_strategy.png",
|
||||
"selectedIconPath": "images/ic_tab_strategy_cur.png",
|
||||
"text": "攻略"
|
||||
},
|
||||
{
|
||||
"pagePath": "pages/mine/mine",
|
||||
"iconPath": "images/ic_tab_mine.png",
|
||||
"selectedIconPath": "images/ic_tab_mine_cur.png",
|
||||
"text": "我的"
|
||||
}
|
||||
],
|
||||
"usingComponents": {}
|
||||
},
|
||||
"usingComponents": {
|
||||
"custom": "/components/custom/index",
|
||||
"prompt": "/components/prompt-dialig/index"
|
||||
},
|
||||
"networkTimeout": {
|
||||
"request": 30000,
|
||||
"connectSocket": 20000,
|
||||
"uploadFile": 60000,
|
||||
"downloadFile": 60000
|
||||
},
|
||||
"navigateToMiniProgramAppIdList": [
|
||||
"wx91d27dbf599dff74"
|
||||
],
|
||||
"sitemapLocation": "sitemap.json"
|
||||
}
|
15
app.wxss
Normal file
@ -0,0 +1,15 @@
|
||||
@import "utils/styles/main.wxss";
|
||||
@import "utils/styles/icon.wxss";
|
||||
@import "utils/styles/animation.wxss";
|
||||
@import "utils/styles/base.wxss";
|
||||
|
||||
/**app.wxss**/
|
||||
.container {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 200rpx 0;
|
||||
box-sizing: border-box;
|
||||
}
|
54
components/custom/index.js
Normal file
@ -0,0 +1,54 @@
|
||||
const app = getApp();
|
||||
Component({
|
||||
/**
|
||||
* 组件的一些选项
|
||||
*/
|
||||
options: {
|
||||
addGlobalClass: true,
|
||||
multipleSlots: true
|
||||
},
|
||||
/**
|
||||
* 组件的对外属性
|
||||
*/
|
||||
properties: {
|
||||
bgColor: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
isCustom: {
|
||||
type: [Boolean, String],
|
||||
default: false
|
||||
},
|
||||
isBack: {
|
||||
type: [Boolean, String],
|
||||
default: false
|
||||
},
|
||||
bgImage: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
},
|
||||
/**
|
||||
* 组件的初始数据
|
||||
*/
|
||||
data: {
|
||||
StatusBar: app.globalData.StatusBar,
|
||||
CustomBar: app.globalData.CustomBar,
|
||||
Custom: app.globalData.Custom
|
||||
},
|
||||
/**
|
||||
* 组件的方法列表
|
||||
*/
|
||||
methods: {
|
||||
BackPage() {
|
||||
wx.navigateBack({
|
||||
delta: 1
|
||||
});
|
||||
},
|
||||
toHome(){
|
||||
wx.reLaunch({
|
||||
url: '/pages/main-two/main-two',
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
4
components/custom/index.json
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {}
|
||||
}
|
16
components/custom/index.wxml
Normal file
@ -0,0 +1,16 @@
|
||||
<view class="cu-custom" style="height:{{CustomBar}}px">
|
||||
<view class="cu-bar fixed {{bgImage!=''?'none-bg text-white bg-img':''}} {{bgColor}}" style="height:{{CustomBar}}px;padding-top:{{StatusBar}}px;{{bgImage?'background-image:url(' + bgImage+')':''}}">
|
||||
<view class="action" bindtap="BackPage" wx:if="{{isBack}}">
|
||||
<text class="cuIcon-back"></text>
|
||||
<slot name="backText"></slot>
|
||||
</view>
|
||||
<view class="action border-custom" wx:if="{{isCustom}}" style="width:{{Custom.width}}px;height:{{Custom.height}}px;margin-left:calc(750rpx - {{Custom.right}}px)">
|
||||
<text class="cuIcon-back" bindtap="BackPage"></text>
|
||||
<text class="cuIcon-homefill" bindtap="toHome"></text>
|
||||
</view>
|
||||
<view class="content" style="top:{{StatusBar}}px">
|
||||
<slot name="content"></slot>
|
||||
</view>
|
||||
<slot name="right"></slot>
|
||||
</view>
|
||||
</view>
|
1
components/custom/index.wxss
Normal file
@ -0,0 +1 @@
|
||||
/* components/custom/index.wxss */
|
86
components/home-page/home-page.js
Normal file
@ -0,0 +1,86 @@
|
||||
const app = getApp()
|
||||
const constants = require("../../utils/constants")
|
||||
const util = require("../../utils/util")
|
||||
const {onLogin} = require("../../utils/network/services/user.js")
|
||||
const {queryProductType, goodsTop} = require("../../utils/network/services/productImpl.js")
|
||||
const {newsList, homeBanner} = require("../../utils/network/services/service.js")
|
||||
let pageStart = 1;
|
||||
|
||||
Component({
|
||||
/**
|
||||
* 组件的属性列表
|
||||
*/
|
||||
properties: {},
|
||||
|
||||
/**
|
||||
* 组件的初始数据
|
||||
*/
|
||||
data: {
|
||||
windowHeight: app.globalData.windowHeight,
|
||||
TabCur: 0,
|
||||
scrollLeft: 0,
|
||||
userInfo: '',
|
||||
requesting: false,
|
||||
end: false,
|
||||
emptyShow: false,
|
||||
page: pageStart,
|
||||
listData: [],
|
||||
hasTop: false,
|
||||
scrollTop: 1,
|
||||
enableBackToTop: false,
|
||||
refreshSize: 90,
|
||||
bottomSize: 100,
|
||||
color: "#3F82FD",
|
||||
empty: false,
|
||||
selectTab: -110,
|
||||
pages: 1,
|
||||
isShowBack: false,
|
||||
isSuperVip: false,
|
||||
invitationDialog: false,
|
||||
searchContent: ''
|
||||
},
|
||||
|
||||
/**
|
||||
* 组件的方法列表
|
||||
*/
|
||||
methods: {
|
||||
login() {
|
||||
let that = this
|
||||
this.selectComponent("#main").refresh();
|
||||
if (!app.globalData.loginStatus) {
|
||||
// 登录
|
||||
wx.login({
|
||||
success: res => {
|
||||
onLogin(res.code)
|
||||
.then(res => {
|
||||
app.globalData.userInfo = res.data.data
|
||||
app.globalData.loginStatus = true
|
||||
util.setStorage(constants.AUTH_INFO, res.data.data)
|
||||
that.setData({userInfo: res.data.data})
|
||||
}).catch((err) => {
|
||||
if (err.data.code = 'USER_NOT_REGISTERED' && app.globalData.loginMode == 'true') {
|
||||
that.data.requesting = false
|
||||
that.setData({token: err.data.data.token})
|
||||
wx.navigateTo({url: '/pages/login/login?token=' + err.data.data.token})
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
onScroll(event) {
|
||||
this.setData({isShowBack: event.detail.detail.scrollTop > this.data.windowHeight * 0.4})
|
||||
},
|
||||
// 刷新数据
|
||||
refresh() {
|
||||
this.login()
|
||||
this.setData({empty: false, requesting: true})
|
||||
},
|
||||
// 加载更多
|
||||
more() {
|
||||
this.selectComponent("#main").onMore()
|
||||
this.setData({requesting: true})
|
||||
setTimeout(() => {this.setData({requesting: false})}, 1000);
|
||||
},
|
||||
}
|
||||
})
|
6
components/home-page/home-page.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"bc-scroll": "/components/refresh/refresh"
|
||||
}
|
||||
}
|
67
components/home-page/home-page.wxml
Normal file
@ -0,0 +1,67 @@
|
||||
<!--components/home-page/home-page.wxml-->
|
||||
<view>
|
||||
<!-- <bc-scroll id="scroll"-->
|
||||
<!-- requesting="{{requesting}}"-->
|
||||
<!-- empty-show="{{emptyShow}}"-->
|
||||
<!-- end="{{end}}"-->
|
||||
<!-- listCount="0"-->
|
||||
<!-- scrollTop="{{scrollTop}}"-->
|
||||
<!-- has-top="{{hasTop}}"-->
|
||||
<!-- enable-back-to-top="{{enableBackToTop}}"-->
|
||||
<!-- refresh-size="{{refreshSize}}"-->
|
||||
<!-- bottom-size="{{bottomSize}}"-->
|
||||
<!-- color="{{color}}"-->
|
||||
<!-- bind:scroll="onScroll"-->
|
||||
<!-- bind:refresh="refresh"-->
|
||||
<!-- bind:more="more">-->
|
||||
<!-- 搜索框 -->
|
||||
<!-- <view class="tab-bg padding-xs bg-white">-->
|
||||
<!-- <view class="flex-row flex-center">-->
|
||||
<!-- <view class="transfer round shadow-blur cuIcon-link"-->
|
||||
<!-- bindtap="onTransfer"-->
|
||||
<!-- wx:if="{{isSuperVip}}">-->
|
||||
<!-- <image style="width: 20rpx;height: 20rpx" class="margin-right-xs" src="../../images/ic_link.png"/>-->
|
||||
<!-- 转链-->
|
||||
<!-- </view>-->
|
||||
<!-- <view class="flex-row flex-center round color6 {{isSuperVip?'search-style1':'search-style'}}"-->
|
||||
<!-- style="background-color: #f2f2f2;"-->
|
||||
<!-- bindtap="goToSearch">-->
|
||||
<!-- <text class="cuIcon-search"></text>-->
|
||||
<!-- <input type="text" disabled="true" placeholder="搜索商品、优惠券" confirm-type="search"></input>-->
|
||||
<!-- </view>-->
|
||||
<!-- </view>-->
|
||||
<!-- <view class="flex-row flex-center">-->
|
||||
<!-- <scroll-view-->
|
||||
<!-- style="width:80%"-->
|
||||
<!-- scroll-x-->
|
||||
<!-- class="tab-bg nav bg-white"-->
|
||||
<!-- scroll-with-animation-->
|
||||
<!-- scroll-left="{{scrollLeft}}">-->
|
||||
<!-- <view class="cu-item {{index==TabCur?'color-main font32 font-w600 cur':'color3'}}"-->
|
||||
<!-- wx:for="{{tabs}}" wx:key="index" bindtap="tabSelect" data-id="{{index}}" data-item="{{item}}">-->
|
||||
<!-- {{item.name}}-->
|
||||
<!-- </view>-->
|
||||
<!-- </scroll-view>-->
|
||||
<!-- <view style="width:20%;" class="font30 font-w600 border-left" bindtap="goToType">-->
|
||||
<!-- 分类-->
|
||||
<!-- <text class="cuIcon-cascades"></text>-->
|
||||
<!-- </view>-->
|
||||
<!-- </view>-->
|
||||
<!-- </view>-->
|
||||
<!-- -->
|
||||
<view hidden="{{isMain}}">
|
||||
<home id="main" bind:NavChange="NavChange" bind:onRefresh1="onRefresh1"/>
|
||||
</view>
|
||||
<view hidden="{{isType}}">
|
||||
<type id="product-list" bind:pageEvent="pageEvent"/>
|
||||
</view>
|
||||
|
||||
<view class='cu-tabbar-height'></view>
|
||||
<!-- </bc-scroll>-->
|
||||
<view class="round float-btn shadow-blur font20 flex-column flex-center"
|
||||
wx:if="{{isShowBack}}"
|
||||
bindtap="goTop">
|
||||
<view class="cuIcon-usefullfill" style="font-size: 26rpx"/>
|
||||
<view >顶部</view>
|
||||
</view>
|
||||
</view>
|
2
components/home-page/home-page.wxss
Normal file
@ -0,0 +1,2 @@
|
||||
/* components/home-page/home-page.wxss */
|
||||
@import "../../pages/index/index.wxss";
|
151
components/new-item/new-item.js
Normal file
@ -0,0 +1,151 @@
|
||||
// components/new-item/new-item.js
|
||||
const app = getApp()
|
||||
Component({
|
||||
/**
|
||||
* 组件的属性列表
|
||||
*/
|
||||
properties: {
|
||||
listData: {
|
||||
type: Array,
|
||||
value: [
|
||||
{
|
||||
title: '成长任务1:升级超级会员省更的多赚的多',
|
||||
content: '建立一个大于50人的微信群完成升级,即可开启省得更多同时分享赚钱等9项特权。',
|
||||
subTitle: '',
|
||||
subContent: '',
|
||||
actionBtn: '去升级',
|
||||
video: '查看教学视频',
|
||||
color: ''
|
||||
},
|
||||
{
|
||||
title: '成长任务2:掌握选爆款和会卖货的技巧',
|
||||
content: '了解小程序内重要的选品频道,并掌握多种发品方式和技巧,为请朋好友带来优惠,自己也能轻松赚取推广费。',
|
||||
subTitle: '想学习更多一定添加专属导师微信!',
|
||||
subContent: 'df33v',
|
||||
actionBtn: '复制微信号',
|
||||
video: '查看教学视频',
|
||||
color: 'color-main'
|
||||
},
|
||||
{
|
||||
title: '成长任务3:近培训群实现收益技能双增长',
|
||||
content: '官方培训群有全方位阶段课程,更有大咖讲师的独家秘诀分享,帮助您的收益和技能实现快速增长。还可以添加导师微信进群学习。',
|
||||
subTitle: '',
|
||||
subContent: '',
|
||||
actionBtn: '',
|
||||
video: '查看教学视频',
|
||||
color: ''
|
||||
},
|
||||
{
|
||||
title: '成长任务4:近爆款群选取更多爆弹素材',
|
||||
content: '官方爆款群是重要选品渠道之一,这里都是全网每天的爆款商品,已图片+视频+软文形式展示增强出单!',
|
||||
subTitle: '从爆款群选品要先转链在发出哦~',
|
||||
subContent: '',
|
||||
actionBtn: '获取进群二维码',
|
||||
video: '查看教学视频',
|
||||
color: 'color6'
|
||||
},
|
||||
{
|
||||
title: '成长任务5:邀请伙伴加入TA赚您更赚',
|
||||
content: '学会邀请伙伴加入的三种方式,帮助伙伴省钱赚钱的同时您还能获得平台的额外奖励,邀请越多赚得就越多哦~',
|
||||
subTitle: '',
|
||||
subContent: '',
|
||||
actionBtn: '去邀请',
|
||||
video: '查看教学视频',
|
||||
color: ''
|
||||
},
|
||||
// {title:'成长任务6:gu',content:'学会邀请伙伴加入的三种方式,帮助伙伴省钱赚钱的同时您还能获得平台的额外奖励,邀请越多赚得就越多哦~',subTitle:'',subContent:'',actionBtn:'复制',video:'',color:''},
|
||||
]
|
||||
}
|
||||
},
|
||||
|
||||
lifetimes: {
|
||||
attached: function () {
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 组件的初始数据
|
||||
*/
|
||||
data: {
|
||||
invitationDialog: '',
|
||||
item:null,
|
||||
mDialog:false
|
||||
},
|
||||
|
||||
/**
|
||||
* 组件的方法列表
|
||||
*/
|
||||
methods: {
|
||||
onClick(event) {
|
||||
const item = event.currentTarget.dataset.item
|
||||
//type=1:跳转页面 2.复制数据 3.显示一张图 4.分享APP
|
||||
switch (item.type) {
|
||||
case 1:
|
||||
wx.navigateTo({
|
||||
url: item.data
|
||||
})
|
||||
break
|
||||
case 2:
|
||||
this.setData({
|
||||
invitationDialog: true,
|
||||
item:item})
|
||||
break
|
||||
case 3:
|
||||
this.setData({mDialog: true,
|
||||
item:item})
|
||||
break
|
||||
case 4:
|
||||
// this.setData({invitationDialog: true})
|
||||
break
|
||||
}
|
||||
},
|
||||
onVideoClick(event) {
|
||||
const item = event.currentTarget.dataset.item
|
||||
console.log(item.videoUrl)
|
||||
const url = encodeURIComponent(item.videoUrl)
|
||||
console.log(url)
|
||||
wx.navigateTo({
|
||||
url: '/page_package/video-course/video-course?url=' + url
|
||||
})
|
||||
// switch (Number(event.currentTarget.dataset.index)) {
|
||||
// case 0:
|
||||
// wx.navigateTo({
|
||||
// url: '/page_package/video-course/video-course'
|
||||
// })
|
||||
// break
|
||||
// }
|
||||
},
|
||||
hideModal(event) {
|
||||
switch (Number(event.currentTarget.dataset.iscode)) {
|
||||
case 0:
|
||||
wx.setClipboardData({
|
||||
data: this.data.item.data,
|
||||
success: function (res) {
|
||||
wx.getClipboardData({
|
||||
success: function (res) {
|
||||
wx.showToast({
|
||||
title: '复制成功'
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
break
|
||||
}
|
||||
this.setData({
|
||||
invitationDialog: false
|
||||
})
|
||||
},
|
||||
onClose() {
|
||||
this.setData({
|
||||
mDialog:false
|
||||
})
|
||||
},
|
||||
previewImg(event) {
|
||||
wx.previewImage({
|
||||
urls: [this.data.item.data],
|
||||
})
|
||||
},
|
||||
}
|
||||
})
|
4
components/new-item/new-item.json
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {}
|
||||
}
|
72
components/new-item/new-item.wxml
Normal file
@ -0,0 +1,72 @@
|
||||
<!--components/new-item/new-item.wxml-->
|
||||
<view class="flex-column padding-sm shadow-blur margin-top-sm"
|
||||
wx:for="{{listData}}" wx:key="*this"
|
||||
style="width: 94%;margin-left: 3%;background-color: white;border-radius: 12rpx;">
|
||||
<view class="color3 font30 font-w600">{{item.title}}</view>
|
||||
|
||||
<view class="color4 font28 margin-top-sm" style="line-height: 44rpx">
|
||||
<rich-text nodes="{{item.content}}"/>
|
||||
</view>
|
||||
|
||||
<!-- <view class="{{item.color}} font28 margin-top-sm" wx:if="{{item.subTitle}}">{{item.subTitle}}</view>-->
|
||||
|
||||
<!-- <view class="color-6 font28 margin-top-sm" wx:if="{{item.data}}">导师微信号:-->
|
||||
<!-- <text class="{{item.color}}">{{item.data}}</text>-->
|
||||
<!-- </view>-->
|
||||
|
||||
<view class="flex-row margin-top-sm" style="align-items: center;text-align: left">
|
||||
<view class="bg-gradual-main action-btn flex-row flex-center"
|
||||
bindtap="onClick" data-index="{{index}}"
|
||||
data-item="{{item}}"
|
||||
wx:if="{{item.action && item.type != 4 }}">{{item.action}}
|
||||
</view>
|
||||
<view class="flex-row" style="background-color: #94ccd4" wx:if="{{item.type == 4}}">
|
||||
<button class="bg-gradual-main share-btn"
|
||||
data-url="{{item.data}}"
|
||||
open-type="share">{{item.action}}</button>
|
||||
</view>
|
||||
<view class="color-main flex-row flex-center" style="position: absolute;right: 5%;"
|
||||
bindtap="onVideoClick" data-index="{{index}}"
|
||||
data-item="{{item}}"
|
||||
wx:if="{{item.videoUrl}}">
|
||||
<view class="cuIcon-playfill"></view>
|
||||
查看教学视频
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
<view class="cu-modal {{invitationDialog ? 'show':''}}">
|
||||
<view class="cu-dialog">
|
||||
<view class="cu-bar bg-white justify-end">
|
||||
<view class="content">提示</view>
|
||||
<view class="action" bindtap="hideModal">
|
||||
<text class="cuIcon-close text-red"></text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="padding-xl bg-gradual-white1 flex-column flex-center font30">
|
||||
<text class="line-height">您的专属导师微信号:{{item.data}}</text>
|
||||
<text class="line-height">关于省钱赚钱的问题,请复制微\n信号去微信添加好友咨询吧~</text>
|
||||
<text class="line-height">添加时请备注:尚橙成员</text>
|
||||
</view>
|
||||
<view class="cu-bar bg-white">
|
||||
<view class="action margin-0 flex-sub solid-left" bindtap="hideModal" data-iscode="1">取消</view>
|
||||
<view class="action margin-0 flex-sub solid-left color-main" bindtap="hideModal" data-iscode="0">复制微信
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="cu-modal {{mDialog ? 'show':''}} flex-column flex-center">
|
||||
<view class="cu-dialog1 color-white flex-column flex-center">
|
||||
<view class="flex-column flex-center">
|
||||
<text class="cuIcon-roundclosefill color-white" style="font-size: 32px" bindtap="onClose"></text>
|
||||
<image src="{{item.data}}" class="margin-top-sm" style="width: 200px;height: 200px;"/>
|
||||
<view class="cu-btn round shadow-blur colorf2 margin-top"
|
||||
style="width: 300rpx;background-color: #f43f3b;height: 72rpx;margin-bottom: 72rpx"
|
||||
bindtap="previewImg">
|
||||
预览长按分享
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
37
components/new-item/new-item.wxss
Normal file
@ -0,0 +1,37 @@
|
||||
/* components/new-item/new-item.wxss */
|
||||
@import "../../utils/styles/main.wxss";
|
||||
@import "../../utils/styles/icon.wxss";
|
||||
@import "../../utils/styles/animation.wxss";
|
||||
@import "../../utils/styles/base.wxss";
|
||||
|
||||
.teach-video{
|
||||
width: 100%;
|
||||
text-align: right;
|
||||
justify-content: right;
|
||||
}
|
||||
|
||||
.action-btn{
|
||||
padding: 14rpx 30rpx;
|
||||
font-size: 26rpx;
|
||||
border-radius: 8rpx;
|
||||
}
|
||||
|
||||
.share-btn{
|
||||
width: 164rpx;
|
||||
height: 56rpx;
|
||||
font-size: 26rpx;
|
||||
border-radius: 8rpx;
|
||||
}
|
||||
|
||||
.cu-dialog1 {
|
||||
position: fixed;
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
width: 680rpx;
|
||||
max-width: 100%;
|
||||
background-color: transparent;
|
||||
border-radius: 10rpx;
|
||||
overflow: hidden;
|
||||
}
|
61
components/order-item/order-item.js
Normal file
@ -0,0 +1,61 @@
|
||||
// components/order-item/order-item.js
|
||||
const app = getApp()
|
||||
const {searchProduct} = require('../../utils/network/services/productImpl.js')
|
||||
const util = require('../../utils/util.js')
|
||||
const constants = require('../../utils/constants.js')
|
||||
Component({
|
||||
/**
|
||||
* 组件的属性列表
|
||||
*/
|
||||
properties: {
|
||||
orderItem: {
|
||||
type: Object,
|
||||
value: {},
|
||||
},
|
||||
type: {
|
||||
type: Number,
|
||||
value: 1
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 组件的初始数据
|
||||
*/
|
||||
data: {
|
||||
windowWidth: app.globalData.windowWidth,
|
||||
isShowDialog: false,
|
||||
msg: "",
|
||||
},
|
||||
|
||||
/**
|
||||
* 组件的方法列表
|
||||
*/
|
||||
methods: {
|
||||
onItem(event) {
|
||||
const item = event.currentTarget.dataset.item
|
||||
const data = {skuIds: [item.skuId]}
|
||||
wx.showLoading({title: '加载中...'})
|
||||
searchProduct(data)
|
||||
.then(res => {
|
||||
wx.hideLoading()
|
||||
if (res.data.data.records.length > 0) {
|
||||
util.setStorage(constants.PRPDUCT_ITEM, res.data.data.records[0])
|
||||
wx.navigateTo({
|
||||
url: '/page_package/details/index'
|
||||
})
|
||||
} else {
|
||||
this.setData({
|
||||
isShowDialog: true,
|
||||
msg: "商品已经失效"
|
||||
})
|
||||
}
|
||||
}).catch(err => {
|
||||
wx.hideLoading()
|
||||
this.setData({
|
||||
isShowDialog: true,
|
||||
msg: "商品已经失效"
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
4
components/order-item/order-item.json
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {}
|
||||
}
|
37
components/order-item/order-item.wxml
Normal file
@ -0,0 +1,37 @@
|
||||
<!--components/order-item/order-item.wxml-->
|
||||
<view class="flex-column padding-sm bg-white margin-top-sm colo6 font26" style="width: 100%">
|
||||
<view class="flex-row">
|
||||
<view>订单编号:{{orderItem.orderId}}</view>
|
||||
<view class="absolute-right">PLUS会员:{{orderItem.plus ? '是':'否'}}</view>
|
||||
</view>
|
||||
<view class="margin-top-xs">下单时间:{{orderItem.orderTime}}</view>
|
||||
<view class="flex-row margin-top-xs">
|
||||
<view>状态:{{orderItem.validCodeDesc}}</view>
|
||||
<view class="absolute-right" wx:if="{{type == 1}}">预估返利收益:<text class="text-price color-main">{{orderItem.estimateRebateFee}}</text></view>
|
||||
<view class="absolute-right" wx:else>预估推广收益:<text class="text-price color-main">{{orderItem.estimateCommissionFee}}</text></view>
|
||||
</view>
|
||||
<view class="flex-row margin-top-xs" wx:for="{{orderItem.skuInfo}}" wx:key="*this"
|
||||
bindtap="onItem" data-item="{{item}}">
|
||||
<image style="width: {{windowWidth*0.3}}px;height: {{windowWidth*0.28}}px;background-color: #f2f2f2" src="{{item.skuImage}}"/>
|
||||
<view class="flex-column margin-left-sm" style="width: {{windowWidth*0.68}}px;">
|
||||
<view class="flex-row">
|
||||
<view class="tag-product">同店</view>
|
||||
<view class="title-style font26 color-black ellipsis" style="width:{{windowWidth * 0.65}}px">
|
||||
{{item.skuName}}
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex-row margin-top-xs">
|
||||
<view>状态:{{item.validCodeDesc}}</view>
|
||||
<view class="absolute-right">编号:{{item.orderId}}</view>
|
||||
</view>
|
||||
<view class="margin-top-xs">数量:{{item.skuNum}}</view>
|
||||
<view class="flex-row margin-top-xs">
|
||||
<view>计佣金额:<text class="text-price color-main">{{item.estimateCosPrice}}</text></view>
|
||||
<view class="absolute-right" wx:if="{{type == 1}}">预估返利收益:<text class="text-price color-main">{{item.estimateRebateFee}}</text></view>
|
||||
<view class="absolute-right" wx:else>预估推广收益:<text class="text-price color-main">{{item.estimateCommissionFee}}</text></view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<prompt promptMsg="{{msg}}" invitationDialog="{{isShowDialog}}" confirmText="确定"/>
|
36
components/order-item/order-item.wxss
Normal file
@ -0,0 +1,36 @@
|
||||
/* components/order-item/order-item.wxss */
|
||||
@import "../../utils/styles/main.wxss";
|
||||
@import "../../utils/styles/icon.wxss";
|
||||
@import "../../utils/styles/animation.wxss";
|
||||
@import "../../utils/styles/base.wxss";
|
||||
|
||||
|
||||
.absolute-right{
|
||||
position: absolute;
|
||||
right: 20rpx;
|
||||
}
|
||||
|
||||
.tag-product {
|
||||
background-color: #f43f3b;
|
||||
color: white;
|
||||
position: absolute;
|
||||
padding: 2rpx 12rpx;
|
||||
font-size: 18rpx;
|
||||
border-radius: 10rpx;
|
||||
margin-left: 20rpx;
|
||||
}
|
||||
|
||||
.title-style {
|
||||
text-indent: 40px;
|
||||
margin-left: 20rpx;
|
||||
letter-spacing: 1rpx;
|
||||
line-height: 36rpx;
|
||||
}
|
||||
|
||||
.ellipsis {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 2;
|
||||
-webkit-box-orient: vertical;
|
||||
}
|
383
components/poster/poster.js
Normal file
@ -0,0 +1,383 @@
|
||||
// components/poster/poster.js
|
||||
const app = getApp()
|
||||
const {appCode} = require("../../utils/network/services/productImpl")
|
||||
|
||||
Component({
|
||||
/**
|
||||
* 组件的属性列表
|
||||
*/
|
||||
properties: {
|
||||
listData: {
|
||||
type: Array,
|
||||
value: [
|
||||
{content: '微信功能升级的利好\n中国巨大的人口市场\n惠享社交电商的模式与北京加持\n2020必将是喷井爆发的一年!这是天时!地利!人和!\n加入惠享让您站在时代的风口上!'},
|
||||
{content: '微信功能升级的利好\n中国巨大的人口市场\n惠享社交电商的模式与北京加持\n2020必将是喷井爆发的一年!这是天时!地利!人和!\n加入惠享让您站在时代的风口上!'},
|
||||
]
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 组件的初始数据
|
||||
*/
|
||||
data: {
|
||||
userInfo: app.globalData.userInfo,
|
||||
imgWidth: 0,
|
||||
imgHeight: 0,
|
||||
invitationDialog: false,
|
||||
mDialog: false,
|
||||
synthesisImg: '',
|
||||
isShow: false,
|
||||
appCodes:'',
|
||||
codeWidth:0,
|
||||
codeHeight:0,
|
||||
selectIndex:-1
|
||||
},
|
||||
|
||||
lifetimes: {
|
||||
attached: function () {
|
||||
this.setData({
|
||||
userInfo: app.globalData.userInfo,
|
||||
imgWidth: app.globalData.windowWidth * 0.7,
|
||||
imgHeight: app.globalData.windowHeight * 0.7,
|
||||
codeWidth: app.globalData.windowWidth * 0.5,
|
||||
codeHeight: app.globalData.windowWidth * 0.5,
|
||||
})
|
||||
},
|
||||
},
|
||||
|
||||
/**
|
||||
* 组件的方法列表
|
||||
*/
|
||||
methods: {
|
||||
onClose() {
|
||||
this.setData({
|
||||
invitationDialog: false,
|
||||
mDialog:false
|
||||
})
|
||||
},
|
||||
onPoster(event) {
|
||||
this.imgLoader(event.currentTarget.dataset.item,event.currentTarget.dataset.index)
|
||||
},
|
||||
saveImg() {
|
||||
wx.saveImageToPhotosAlbum({
|
||||
filePath: this.data.synthesisImg,
|
||||
success: (res) => {
|
||||
this.setData({invitationDialog: false})
|
||||
wx.hideLoading()
|
||||
wx.showModal({
|
||||
title: '提示',
|
||||
showCancel: false,
|
||||
content: '图片保存成功,进入系统相册分享吧~',
|
||||
success(res) {
|
||||
if (res.confirm) {
|
||||
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
fail: (err) => {
|
||||
this.setData({invitationDialog: false})
|
||||
wx.hideLoading()
|
||||
wx.showModal({
|
||||
title: '提示',
|
||||
showCancel: false,
|
||||
content: '请到小程序设置中打开相册权限',
|
||||
success(res) {
|
||||
if (res.confirm) {
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
saveImg1(){
|
||||
wx.saveImageToPhotosAlbum({
|
||||
filePath: this.data.appCodes,
|
||||
success: (res) => {
|
||||
this.setData({mDialog: false})
|
||||
wx.hideLoading()
|
||||
wx.showModal({
|
||||
title: '提示',
|
||||
showCancel: false,
|
||||
content: '图片保存成功,进入系统相册分享吧~',
|
||||
success(res) {
|
||||
if (res.confirm) {
|
||||
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
fail: (err) => {
|
||||
this.setData({mDialog: false})
|
||||
wx.hideLoading()
|
||||
wx.showModal({
|
||||
title: '提示',
|
||||
showCancel: false,
|
||||
content: '请到小程序设置中打开相册权限',
|
||||
success(res) {
|
||||
if (res.confirm) {
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
imgLoader(item,index) {
|
||||
if (this.data.synthesisImg && this.data.selectIndex == index) {
|
||||
this.setData({invitationDialog: true})
|
||||
} else {
|
||||
let that = this
|
||||
this.setData({
|
||||
// invitationDialog: true,
|
||||
selectIndex:index
|
||||
})
|
||||
wx.showLoading({title: '合成中...',})
|
||||
Promise.all([
|
||||
new Promise((resolve, reject) => {
|
||||
wx.getImageInfo({
|
||||
src: item.imageUrl,
|
||||
success(res) {
|
||||
resolve(res)
|
||||
},
|
||||
fail(err) {
|
||||
err.prompt = '合成分享图失败'
|
||||
reject(err)
|
||||
}
|
||||
})
|
||||
}),
|
||||
new Promise((resolve, reject) => {
|
||||
wx.getImageInfo({
|
||||
src: that.data.userInfo.avatarUrl,
|
||||
success(res) {
|
||||
resolve(res)
|
||||
},
|
||||
fail(err) {
|
||||
err.prompt = '合成头像失败'
|
||||
reject(err)
|
||||
}
|
||||
})
|
||||
}),
|
||||
new Promise((resolve, reject) => {
|
||||
let data = {
|
||||
page: "pages/index/index",
|
||||
scene: {id:that.data.userInfo.userId },
|
||||
size: 72
|
||||
}
|
||||
appCode(data)
|
||||
.then(res => {
|
||||
wx.showLoading({title: '合成中...',})
|
||||
let filePath = `${wx.env.USER_DATA_PATH}/${that.data.userInfo.userId}`;
|
||||
wx.getFileSystemManager().writeFile({
|
||||
filePath: filePath,
|
||||
data: wx.base64ToArrayBuffer(res.data.data.content),
|
||||
encoding: 'binary',
|
||||
success: () => {
|
||||
resolve(filePath);
|
||||
},
|
||||
fail: err => {
|
||||
err.prompt = '合成推广码失败'
|
||||
reject(err);
|
||||
},
|
||||
});
|
||||
}).catch((err) => {
|
||||
err.prompt = '获取推广码失败'
|
||||
reject(err);
|
||||
})
|
||||
})
|
||||
]).then(res => {
|
||||
const ctx = wx.createCanvasContext('myCanvas', that);
|
||||
ctx.fillStyle = "#FFFFFF";
|
||||
ctx.fillRect(0, 0, that.data.imgWidth, that.data.imgHeight);
|
||||
that.setData({ctx: ctx})
|
||||
const productImg = res[0].path //f分享图图
|
||||
|
||||
const avatarUrl = res[1].path //用户头像
|
||||
const userName = that.data.userInfo.nickName //用户昵称
|
||||
|
||||
//绘制商品图
|
||||
ctx.drawImage(productImg, 0, 0, that.data.imgWidth, that.data.imgHeight * 0.75);
|
||||
ctx.save();
|
||||
|
||||
let imgH = that.data.imgHeight * 0.75
|
||||
|
||||
//商品标题第一行
|
||||
ctx.setTextAlign('left')
|
||||
ctx.setFillStyle('#000000')
|
||||
ctx.setFontSize(16)
|
||||
ctx.fillText("尚橙优选·分享好物", 10, imgH + 24)
|
||||
ctx.stroke()
|
||||
|
||||
//用户昵称
|
||||
ctx.setTextAlign('left')
|
||||
ctx.setFillStyle('#333333')
|
||||
ctx.setFontSize(12)
|
||||
ctx.fillText(userName, 68, imgH + 54)
|
||||
ctx.stroke()
|
||||
|
||||
//推广语
|
||||
ctx.setTextAlign('left')
|
||||
ctx.setFillStyle('#444444')
|
||||
ctx.setFontSize(11)
|
||||
ctx.fillText('邀您一起加入尚橙', 68, imgH + 74)
|
||||
ctx.stroke()
|
||||
//推广语
|
||||
ctx.setTextAlign('left')
|
||||
ctx.setFillStyle('#666666')
|
||||
ctx.setFontSize(9)
|
||||
ctx.fillText('分享京东优惠好货', 68, imgH + 89)
|
||||
ctx.stroke()
|
||||
//
|
||||
// //
|
||||
ctx.setTextAlign('right')
|
||||
ctx.setFillStyle('#444444')
|
||||
ctx.setFontSize(9)
|
||||
ctx.fillText('长按识别', that.data.imgWidth - 24, that.data.imgHeight - 10)
|
||||
ctx.stroke()
|
||||
//
|
||||
//用户头像
|
||||
ctx.arc(34, imgH + 64, 24, 0, Math.PI * 2, false);
|
||||
ctx.clip();
|
||||
ctx.drawImage(avatarUrl, 10, imgH + 40, 48, 48);
|
||||
ctx.restore();
|
||||
|
||||
// 推广二维码
|
||||
ctx.drawImage(res[2], that.data.imgWidth - 74, that.data.imgHeight - 88, 64, 64);
|
||||
ctx.restore();
|
||||
|
||||
ctx.draw()
|
||||
setTimeout(() => {
|
||||
that.heIMg(that,1)
|
||||
}, 50)
|
||||
}).catch(err => {
|
||||
console.log(">>>", err)
|
||||
wx.hideLoading()
|
||||
wx.showModal({
|
||||
title: '提示',
|
||||
showCancel: false,
|
||||
content: "合成图片失败",
|
||||
success(res) {
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
},
|
||||
heIMg(that,type) {
|
||||
if(type == 1){
|
||||
wx.canvasToTempFilePath({
|
||||
x: 0,
|
||||
y: 0,
|
||||
width: that.data.imgWidth,
|
||||
height: that.data.imgHeight,
|
||||
canvasId: 'myCanvas',
|
||||
success: function (res) {
|
||||
wx.hideLoading()
|
||||
that.setData({
|
||||
synthesisImg: res.tempFilePath,
|
||||
isShow:false,
|
||||
invitationDialog: true
|
||||
})
|
||||
},
|
||||
fail: function (err) {
|
||||
wx.hideLoading()
|
||||
}
|
||||
}, that)
|
||||
}else {
|
||||
wx.canvasToTempFilePath({
|
||||
x: 0,
|
||||
y: 0,
|
||||
width: that.data.codeWidth,
|
||||
height: that.data.codeWidth,
|
||||
canvasId: 'myCanvas1',
|
||||
success: function (res) {
|
||||
wx.hideLoading()
|
||||
that.setData({
|
||||
appCodes: res.tempFilePath,
|
||||
mDialog: true
|
||||
})
|
||||
},
|
||||
fail: function (err) {
|
||||
wx.hideLoading()
|
||||
}
|
||||
}, that)
|
||||
}
|
||||
|
||||
},
|
||||
onCopy(event){
|
||||
const item = event.currentTarget.dataset.item
|
||||
wx.setClipboardData({
|
||||
data: item.content,
|
||||
success: function (res) {
|
||||
wx.getClipboardData({
|
||||
success: function (res) {
|
||||
wx.showToast({
|
||||
title: '复制成功'
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
appsCode(){
|
||||
if (this.data.appCodes) {
|
||||
this.setData({mDialog: true})
|
||||
} else {
|
||||
let that = this
|
||||
wx.showLoading({title: '合成中...',})
|
||||
Promise.all([
|
||||
new Promise((resolve, reject) => {
|
||||
let data = {
|
||||
page: "pages/index/index",
|
||||
scene: {id:that.data.userInfo.userId },
|
||||
size: that.data.codeWidth
|
||||
}
|
||||
appCode(data)
|
||||
.then(res => {
|
||||
let filePath = `${wx.env.USER_DATA_PATH}/${that.data.userInfo.userId}` + 1;
|
||||
wx.getFileSystemManager().writeFile({
|
||||
filePath: filePath,
|
||||
data: wx.base64ToArrayBuffer(res.data.data.content),
|
||||
encoding: 'binary',
|
||||
success: () => {
|
||||
resolve(filePath);
|
||||
},
|
||||
fail: err => {
|
||||
err.prompt = '合成推广码失败'
|
||||
reject(err);
|
||||
},
|
||||
});
|
||||
}).catch((err) => {
|
||||
err.prompt = '获取推广码失败'
|
||||
reject(err);
|
||||
})
|
||||
})
|
||||
]).then(res => {
|
||||
const ctx = wx.createCanvasContext('myCanvas1', that);
|
||||
ctx.fillStyle = "#FFFFFF";
|
||||
ctx.fillRect(0, 0, that.data.codeWidth, that.data.codeHeight);
|
||||
const productImg = res[0] //f分享图图
|
||||
|
||||
console.log("推广码",res,productImg)
|
||||
//绘制商品图
|
||||
ctx.drawImage(productImg, 0, 0, that.data.codeWidth, that.data.codeHeight);
|
||||
ctx.save();
|
||||
|
||||
ctx.draw()
|
||||
setTimeout(() => {
|
||||
that.heIMg(that,2)
|
||||
}, 50)
|
||||
}).catch(err => {
|
||||
console.log(">>>", err)
|
||||
wx.hideLoading()
|
||||
wx.showModal({
|
||||
title: '提示',
|
||||
showCancel: false,
|
||||
content: "合成图片失败",
|
||||
success(res) {
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
4
components/poster/poster.json
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {}
|
||||
}
|
74
components/poster/poster.wxml
Normal file
@ -0,0 +1,74 @@
|
||||
<!--components/poster/poster.wxml-->
|
||||
|
||||
<canvas canvas-id="myCanvas" class="margin-top-sm {{!synthesisImg?'':'bg-white'}}"
|
||||
wx:if="{{!synthesisImg}}"
|
||||
style="width: {{imgWidth}}px;height: {{imgHeight}}px;position: absolute;z-index: -1;top: 0"></canvas>
|
||||
|
||||
<canvas canvas-id="myCanvas1" class="margin-top-sm bg-white"
|
||||
wx:if="{{!appCodes}}"
|
||||
style="width: {{codeWidth}}px;height: {{codeHeight}}px;position: absolute;z-index: -1;top: 0"></canvas>
|
||||
|
||||
<view style="z-index: 1007;position: absolute;top: 46px;width: 100%">
|
||||
<view style="width: 100%;background-color: white">
|
||||
<view class="cu-btn code-bg radius" style="width: 90%;margin-left: 5%;height: 64rpx;"
|
||||
bindtap="appsCode">
|
||||
<view class="cuIcon-forwardfill color-main"></view>
|
||||
<view class="color3 margin-left-xs">获取我的高清小程序码</view>
|
||||
<view class="cuIcon-right color3" style="position: absolute;right: 24rpx"></view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex-column padding margin-bottom-sm"
|
||||
wx:for="{{listData}}"
|
||||
wx:key="*this"
|
||||
style="background-color: white;">
|
||||
<view class="flex-row" style="align-items: center">
|
||||
<image class="cu-avatar lg round" src="{{item.iconUrl}}"/>
|
||||
<view class="font28 color3 font-w600 margin-left-xs">{{item.title}}</view>
|
||||
</view>
|
||||
<view class="flex-row margin-top-xs">
|
||||
<view class="flex-column" style="width: 65%">
|
||||
<text class="color4 font24" style="line-height: 38rpx">{{item.content}}</text>
|
||||
<view class="colorff9700 margin-top-sm">#点击图片获取您的专属海报#</view>
|
||||
<image style="width: 84px;height: 256rpx"
|
||||
class="margin-top-sm"
|
||||
bindtap="onPoster"
|
||||
data-item="{{item}}"
|
||||
data-index="{{index}}"
|
||||
src="{{item.imageUrl}}"/>
|
||||
</view>
|
||||
<view style="width: 28%;text-align: center;justify-content: center" class="flex-row padding-left">
|
||||
<view class="color-main margin-left copy-btn flex-row flex-center"
|
||||
bindtap="onCopy" data-item="{{item}}">复制文字</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
<view class="cu-modal {{invitationDialog ? 'show':''}} flex-column flex-center">
|
||||
<view class="cu-dialog1 color-white flex-column flex-center">
|
||||
<view class="flex-column flex-center">
|
||||
<text class="cuIcon-roundclosefill color-white" style="font-size: 32px" bindtap="onClose"></text>
|
||||
<image src="{{synthesisImg}}" style="width: {{imgWidth}}px;height: {{imgHeight}}px;"/>
|
||||
<view class="cu-btn round shadow-blur colorf2 margin-top"
|
||||
style="width: 500rpx;background-color: #f43f3b;height: 72rpx;margin-bottom: 72rpx"
|
||||
bindtap="saveImg">
|
||||
保存到手机相册
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="cu-modal {{mDialog ? 'show':''}} flex-column flex-center">
|
||||
<view class="cu-dialog1 color-white flex-column flex-center">
|
||||
<view class="flex-column flex-center">
|
||||
<text class="cuIcon-roundclosefill color-white" style="font-size: 32px" bindtap="onClose"></text>
|
||||
<image src="{{appCodes}}" style="width: {{codeWidth}}px;height: {{codeWidth}}px;"/>
|
||||
<view class="cu-btn round shadow-blur colorf2 margin-top"
|
||||
style="width: 300rpx;background-color: #f43f3b;height: 72rpx;margin-bottom: 72rpx"
|
||||
bindtap="saveImg1">
|
||||
保存到手机相册
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
62
components/poster/poster.wxss
Normal file
@ -0,0 +1,62 @@
|
||||
/* components/poster/poster.wxss */
|
||||
@import "../../utils/styles/main.wxss";
|
||||
@import "../../utils/styles/icon.wxss";
|
||||
@import "../../utils/styles/animation.wxss";
|
||||
@import "../../utils/styles/base.wxss";
|
||||
|
||||
|
||||
.colorff9700{
|
||||
color: #ff9700;
|
||||
}
|
||||
|
||||
.copy-btn{
|
||||
height: 48rpx;
|
||||
width: 164rpx;
|
||||
border-radius: 32rpx;
|
||||
font-size: 24rpx;
|
||||
margin-left: 20rpx;
|
||||
border: 1px solid #f43f3b;
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
.bc-modal {
|
||||
display: flex;
|
||||
position: fixed;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
top: 0px;
|
||||
left: 0px;
|
||||
z-index: 999;
|
||||
text-align: center;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
background-color: rgba(0, 0, 0, 0.5);
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.modal-content{
|
||||
background: white;
|
||||
display: flex;
|
||||
text-align: center;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.cu-dialog1 {
|
||||
position: fixed;
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
width: 680rpx;
|
||||
max-width: 100%;
|
||||
background-color: transparent;
|
||||
border-radius: 10rpx;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.code-bg{
|
||||
background-image: linear-gradient(45deg, #FEF3E0, #FFEEEF);
|
||||
color: var(--white);
|
||||
}
|
40
components/product-item/product-item.js
Normal file
@ -0,0 +1,40 @@
|
||||
// components/product-item/product-item.js
|
||||
const app = getApp()
|
||||
|
||||
Component({
|
||||
options: {
|
||||
multipleSlots: true // 在组件定义时的选项中启用多slot支持
|
||||
},
|
||||
/**
|
||||
* 组件的属性列表
|
||||
*/
|
||||
properties: {
|
||||
productItem: {
|
||||
type: Object,
|
||||
value: {},
|
||||
},
|
||||
},
|
||||
|
||||
/**
|
||||
* 组件的初始数据
|
||||
*/
|
||||
data: {
|
||||
windowWidth: app.globalData.windowWidth,
|
||||
|
||||
},
|
||||
|
||||
lifetimes: {
|
||||
attached: function () {
|
||||
// let productItem = this.data.productItem
|
||||
// (productItem.priceInfo.lowestCouponPrice ?
|
||||
// productItem.priceInfo.lowestCouponPrice:productItem.priceInfo.price) - productItem.commissionInfo.commission
|
||||
},
|
||||
},
|
||||
|
||||
/**
|
||||
* 组件的方法列表
|
||||
*/
|
||||
methods: {
|
||||
|
||||
}
|
||||
})
|
4
components/product-item/product-item.json
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {}
|
||||
}
|
68
components/product-item/product-item.wxml
Normal file
@ -0,0 +1,68 @@
|
||||
<!--components/product-item/product-item.wxml-->
|
||||
<view>
|
||||
<view class="flex-row" style="margin-top: 20rpx;">
|
||||
<image src="{{productItem.images[0]}}"
|
||||
style="width:{{windowWidth*0.38}}px;height:{{windowWidth*0.35}}px;border-radius: 8rpx;margin-left:20rpx"></image>
|
||||
<view class="flex-column">
|
||||
<view class="flex-row margin-top-xs">
|
||||
<view class="tag-product">京东</view>
|
||||
<view class="title-style font28 color3 ellipsis" style="width:{{windowWidth * 0.58}}px">
|
||||
{{productItem.skuName}}
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="flex-row font20 color8 margin-left-sm margin-top-xs">
|
||||
<view>京东价</view>
|
||||
<text style="text-decoration:line-through;margin-top:5rpx" class="text-price font20">{{productItem.priceInfo.price}}</text>
|
||||
<view class="comment flex-row">
|
||||
<view>{{productItem.comments}}条评论</view>
|
||||
<view class="margin-left-xs">{{productItem.goodCommentsShare}}%好评率</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view style="width:{{windowWidth * 0.20}}px;height: 1.2rem;" class="margin-left-sm margin-top-sm">
|
||||
<view class="coupon-item">
|
||||
<view class="style-three bg-gradual-main flex-row flex-center">
|
||||
<view class="font20" wx:if="{{productItem.coupons[0].discount}}">优惠券
|
||||
<text class="text-price font20">{{productItem.coupons[0].discount ?
|
||||
productItem.coupons[0].discount : 0}}
|
||||
</text>
|
||||
</view>
|
||||
<view class="font20" wx:else>
|
||||
<text class="font20">{{productItem.commissionInfo.rebateHint}}
|
||||
</text>
|
||||
</view>
|
||||
<view class="get-btn"></view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="flex-row margin-left-sm margin-top-sm" style=" align-items: center;">
|
||||
<view class="color-main font26" wx:if="{{productItem.coupons[0].discount}}">券后价
|
||||
<text class="text-price color-main font34 font-w600">{{productItem.priceInfo.lowestCouponPrice ?
|
||||
productItem.priceInfo.lowestCouponPrice:productItem.priceInfo.price}}
|
||||
</text>
|
||||
</view>
|
||||
<view class="color-main font26" wx:else>返利价
|
||||
<text class="text-price color-main font34 font-w600">{{productItem.priceInfo.lowestRebatePrice}}
|
||||
</text>
|
||||
</view>
|
||||
<view class="comment">
|
||||
<view class="round bg-red shadow-blur font20 flex-row flex-center"
|
||||
style="height: 40rpx;width: 96rpx">马上抢
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex-row margin-top margin-left" style="text-align: end;justify-content: end"
|
||||
wx:if="{{productItem.commissionInfo.commissionHint}}">
|
||||
<view class="font31 font-w600"></view>
|
||||
<view class="flex-row flex-center" style="height: 40rpx">
|
||||
<view class="cu-btn round bg-yellow shadow-blur"
|
||||
style="height:40rpx; font-size: 20rpx;color: #A78C72;background-color: #FFEED5;right: 20rpx;position: absolute;right: 20rpx">{{productItem.commissionInfo.commissionHint}} </view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="line-division"></view>
|
||||
|
||||
</view>
|
135
components/product-item/product-item.wxss
Normal file
@ -0,0 +1,135 @@
|
||||
/* components/product-item/product-item.wxss */
|
||||
@import "../../utils/styles/main.wxss";
|
||||
@import "../../utils/styles/icon.wxss";
|
||||
@import "../../utils/styles/animation.wxss";
|
||||
@import "../../utils/styles/base.wxss";
|
||||
|
||||
.bg-item{
|
||||
background-color: white;
|
||||
width: 200rpx;
|
||||
color: #f43f3b;
|
||||
border-radius: 5rpx;
|
||||
border: 1px solid #f43f3b;
|
||||
padding: 6rpx 10rpx;
|
||||
margin-left: 20rpx;
|
||||
margin-top: 20rpx;
|
||||
}
|
||||
|
||||
.tag-product {
|
||||
background-color: #f43f3b;
|
||||
color: white;
|
||||
position: absolute;
|
||||
padding: 4rpx 12rpx;
|
||||
font-size: 20rpx;
|
||||
margin-top: 6rpx;
|
||||
border-radius: 10rpx;
|
||||
margin-left: 20rpx;
|
||||
}
|
||||
|
||||
.title-style {
|
||||
text-indent: 40px;
|
||||
margin-left: 20rpx;
|
||||
letter-spacing: 1rpx;
|
||||
line-height: 48rpx;
|
||||
}
|
||||
|
||||
.ellipsis {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 2;
|
||||
-webkit-box-orient: vertical;
|
||||
}
|
||||
|
||||
.comment{
|
||||
display: flex;
|
||||
text-align: end;
|
||||
justify-content: end;
|
||||
right: 20rpx;
|
||||
}
|
||||
|
||||
.semicircle-left{
|
||||
width: 20rpx;
|
||||
height: 20rpx;
|
||||
background-color: white;
|
||||
border-bottom-left-radius: 50%;
|
||||
border-top-left-radius: 50%
|
||||
}
|
||||
|
||||
.line-division{
|
||||
width: 96%;
|
||||
height: 2rpx;
|
||||
margin-left: 2%;
|
||||
margin-top: 20rpx;
|
||||
background-color: #f2f2f2
|
||||
}
|
||||
|
||||
.comment{
|
||||
position: absolute;
|
||||
right: 20rpx;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.style-three {
|
||||
width:100%;
|
||||
height:1.2rem;
|
||||
position:relative;
|
||||
display:-webkit-box;
|
||||
display:-webkit-flex;
|
||||
display:flex;
|
||||
align-items:center;
|
||||
justify-content:center;
|
||||
background-color:#f43f3b;
|
||||
border:none;
|
||||
color:#fff;
|
||||
}
|
||||
|
||||
.style-three:before {
|
||||
content:"";
|
||||
position:absolute;
|
||||
left:-.25rem;
|
||||
width:.9rem;
|
||||
height:.55rem;
|
||||
top:50%;
|
||||
-webkit-transform:translate(-30%,-50%);
|
||||
transform:translate(-30%,-50%);
|
||||
-webkit-box-shadow:3px 0 0 #e76960;
|
||||
box-shadow:3px 0 0 #e76960;
|
||||
-webkit-border-radius:80%;
|
||||
border-radius:80%;
|
||||
background-color:white;
|
||||
}
|
||||
|
||||
.style-three .get-btn:after {
|
||||
content:"";
|
||||
width:.6rem;
|
||||
position:absolute;
|
||||
top:0;
|
||||
bottom:0;
|
||||
right:23.9%;
|
||||
left:0;
|
||||
display:block;
|
||||
z-index:9;
|
||||
background-color:white;
|
||||
background-position:100% 35%;
|
||||
background-size:1rem .5rem;
|
||||
background-image:linear-gradient(-45deg,#ffffff 25%,#e76960 25%,#e76960)
|
||||
}
|
||||
|
||||
.style-three .get-btn {
|
||||
display:-webkit-box;
|
||||
display:-webkit-flex;
|
||||
display:flex;
|
||||
position: absolute;
|
||||
right: 0;
|
||||
align-items:center;
|
||||
justify-content:center;
|
||||
width:5%;
|
||||
height:1.2rem;
|
||||
text-align:center;
|
||||
color:#fff;
|
||||
font-size:1.5rem;
|
||||
line-height:1.35;
|
||||
background-color:#fff;
|
||||
}
|
45
components/prompt-dialig/index.js
Normal file
@ -0,0 +1,45 @@
|
||||
// components/prompt-dialig/index.js
|
||||
Component({
|
||||
/**
|
||||
* 组件的属性列表
|
||||
*/
|
||||
properties: {
|
||||
cancelText: {
|
||||
type: String,
|
||||
default: "取消"
|
||||
},
|
||||
confirmText: {
|
||||
type: String,
|
||||
default: "确定"
|
||||
},
|
||||
promptMsg: {
|
||||
type: String,
|
||||
default: "提示消息",
|
||||
},
|
||||
invitationDialog: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
isShowCancel: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 组件的初始数据
|
||||
*/
|
||||
data: {},
|
||||
|
||||
/**
|
||||
* 组件的方法列表
|
||||
*/
|
||||
methods: {
|
||||
hideModal(event) {
|
||||
this.setData({invitationDialog:false})
|
||||
if(event.currentTarget.dataset.iscode == 0)
|
||||
this.triggerEvent("onConfirm")
|
||||
}
|
||||
}
|
||||
})
|
4
components/prompt-dialig/index.json
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {}
|
||||
}
|
20
components/prompt-dialig/index.wxml
Normal file
@ -0,0 +1,20 @@
|
||||
<!--components/prompt-dialig/index.wxml-->
|
||||
<view class="cu-modal {{invitationDialog ? 'show':''}}">
|
||||
<view class="cu-dialog">
|
||||
<view class="cu-bar bg-white justify-end">
|
||||
<view class="content">提示</view>
|
||||
</view>
|
||||
<view class="padding-xl bg-gradual-white1 flex-column flex-center font30">
|
||||
<text class="line-height">{{promptMsg}}</text>
|
||||
</view>
|
||||
<view class="cu-bar bg-white">
|
||||
<view class="action margin-0 flex-sub solid-left" bindtap="hideModal"
|
||||
wx:if="{{isShowCancel}}"
|
||||
style="width: 50%"
|
||||
data-iscode="1">{{cancelText}}</view>
|
||||
<view class="action margin-0 flex-sub solid-left color-main"
|
||||
style="width: 50%"
|
||||
bindtap="hideModal" data-iscode="0">{{confirmText}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
5
components/prompt-dialig/index.wxss
Normal file
@ -0,0 +1,5 @@
|
||||
/* components/prompt-dialig/index.wxss */
|
||||
@import "../../utils/styles/main.wxss";
|
||||
@import "../../utils/styles/icon.wxss";
|
||||
@import "../../utils/styles/animation.wxss";
|
||||
@import "../../utils/styles/base.wxss";
|
86
components/question/question.js
Normal file
@ -0,0 +1,86 @@
|
||||
// components/question/question.js
|
||||
const app = getApp()
|
||||
const constants = require("../../utils/constants")
|
||||
const util = require("../../utils/util")
|
||||
const {faq} = require("../../utils/network/services/service")
|
||||
const startPage = 1
|
||||
Component({
|
||||
/**
|
||||
* 组件的属性列表
|
||||
*/
|
||||
properties: {
|
||||
listData: {
|
||||
type: Array,
|
||||
value: [
|
||||
{
|
||||
open: false,
|
||||
questionList: [
|
||||
{
|
||||
title: '哪些情况会造成订单无效?',
|
||||
content: '1.涉嫌利用本平台实施欺诈或其他违法行为(运营方有权单方对此作出独立认定);\n' +
|
||||
'\n' +
|
||||
'2.被任何第三方投诉或被相关司法、行政机关处理的;\n' +
|
||||
'\n' +
|
||||
'3.恶意使用本平台功能,使用任何装置、软件或例行程序干预或试图干预京东台或本平台的;\n' +
|
||||
'\n' +
|
||||
'4.利用计算机病毒/程序等手段,非法窃取、删除、修改或增加其他会员的任何信 息,或以其他任何方式危害京东平台/本平台其他功能的正常运行;\n' +
|
||||
'\n' +
|
||||
'5.利用京东CPS系统漏洞,谋取利益;\n' +
|
||||
'\n' +
|
||||
'6.未经运营方书面同意,擅自许可他人使用本平台或擅自将本平台功能全部或部 分转让他人(包括但不限于擅自许可他人使用其帐号利用京本平台进行推广,或擅自将其帐号转让或泄露给他人的);\n' +
|
||||
'\n' +
|
||||
'7.以不良方法或技术等规避本协议约定和规则要求等;\n' +
|
||||
'\n' +
|
||||
'8.通过程序、脚本模拟或其他形式进行或产生非正常的浏览、点击、交易行为等。通过奖励、诱导点击、弹窗、自动模拟用户点击等行为,产生非正常的浏览、点击、成交的行为;\n' +
|
||||
'\n' +
|
||||
'9.流量劫持。如通过病毒、木马、恶意插件和未经授权软件捆绑安装、强设首页、劫持地址栏或浏览器、劫持京东页面、搜索引擎作弊、篡改用户信息等非常规手段劫持正常流量。或通过链路劫持、DNS劫持、或者ARP攻击等手段劫持正常流量。或者在用户正常浏览过程中,通过修改URL参数或弹窗(浮窗)等的方式劫持京东商城或京东合作伙伴的正常流量(包括京东页面、合作伙伴和其他网站等);\n' +
|
||||
'\n' +
|
||||
'10.其他京东联盟有合理理由证明的数据异常(如流量来源、分布等)情况。会员承诺并保证:按本协议约定使用本平台并进行推广,遵守平台规则,按约定收取服务费并支付平台费。'
|
||||
},
|
||||
{
|
||||
title: '什么是“上月预估结算佣金”、“本月预估结算佣金”?',
|
||||
content: '上月预估结算佣金:上个自然月产生的已完成订单的预估佣金总额,最终结算金额以账单中的结算数据为准。\n' +
|
||||
'\n' +
|
||||
'本月预估结算佣金:本个自然月(不包含当日)产生的已完成订单的预估佣金总额,最终结算金额以账单中的结算数据为准。 '
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 组件的初始数据
|
||||
*/
|
||||
data: {
|
||||
windowWidth: app.globalData.windowWidth,
|
||||
questionList:[],
|
||||
page:startPage
|
||||
},
|
||||
|
||||
/**
|
||||
* 组件的方法列表
|
||||
*/
|
||||
methods: {
|
||||
onShrink(event) {
|
||||
let index = event.currentTarget.dataset.index
|
||||
let item = event.currentTarget.dataset.item
|
||||
item.open = !item.open
|
||||
let listData = this.data.listData
|
||||
listData.splice(index, 1, item)
|
||||
this.setData({listData: listData})
|
||||
},
|
||||
itemClick(event) {
|
||||
let item = event.currentTarget.dataset.items
|
||||
util.setStorage(constants.QUESTION,item)
|
||||
wx.navigateTo({
|
||||
url: '/page_package/question/question'
|
||||
})
|
||||
},
|
||||
getData(type){
|
||||
faq().then(res => {
|
||||
this.setData({questionList:res.data.data})
|
||||
})
|
||||
},
|
||||
},
|
||||
})
|
4
components/question/question.json
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {}
|
||||
}
|
32
components/question/question.wxml
Normal file
@ -0,0 +1,32 @@
|
||||
<!--components/question/question.wxml-->
|
||||
<view class="flex-column margin-top-sm" wx:for="{{listData}}" wx:key="*this">
|
||||
<view style="background-color: white">
|
||||
<view class="flex-row">
|
||||
<view class="flex-row question-icon margin-top-xl">
|
||||
<view class="flex-column flex-center">
|
||||
<!-- goodsfill-->
|
||||
<view class="type-icon flex-row flex-center"><text class="cuIcon-{{item.icon}} font34"></text></view>
|
||||
<view class="margin-top-sm color4">{{item.category}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex-column question-list">
|
||||
<view wx:for="{{item.questions}}" wx:key="*this"
|
||||
wx:for-item="items"
|
||||
wx:if="{{item.open? true : index < 2}}"
|
||||
bindtap="itemClick"
|
||||
data-items="{{items}}"
|
||||
class="question-item flex-row ellipsis font26 color6">{{items.title}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view style="height: 40rpx;width: 20rpx"></view>
|
||||
</view>
|
||||
|
||||
<!-- fold-->
|
||||
<view class="flex-row flex-center">
|
||||
<view class="shrink-btn color-main font26" bindtap="onShrink" data-index="{{index}}" data-item="{{item}}">{{item.open?'折叠收回':'展开更多'}}
|
||||
<text class="cuIcon-{{item.open?'fold':'unfold'}}"/>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
46
components/question/question.wxss
Normal file
@ -0,0 +1,46 @@
|
||||
/* components/question/question.wxss */
|
||||
@import "../../utils/styles/main.wxss";
|
||||
@import "../../utils/styles/icon.wxss";
|
||||
@import "../../utils/styles/animation.wxss";
|
||||
@import "../../utils/styles/base.wxss";
|
||||
|
||||
.question-icon{
|
||||
width: 218rpx;
|
||||
align-items: start;
|
||||
text-align: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.question-list{
|
||||
border-left: 1px solid #f2f2f2;
|
||||
}
|
||||
|
||||
.question-item{
|
||||
height: 84rpx;
|
||||
border-top: 1px solid #f2f2f2;
|
||||
align-items: center;
|
||||
width: calc(100vw - 250rpx);
|
||||
padding-left: 20rpx;
|
||||
}
|
||||
|
||||
.ellipsis{
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.shrink-btn{
|
||||
background-color: white;
|
||||
padding: 8rpx 16rpx;
|
||||
border-radius: 24rpx;
|
||||
margin-top: -32rpx;
|
||||
|
||||
}
|
||||
|
||||
.type-icon{
|
||||
width: 56rpx;
|
||||
height: 56rpx;
|
||||
background-image: linear-gradient(90deg, #f43f3b, #da7068);
|
||||
border-radius: 50%;
|
||||
color: white;
|
||||
}
|
227
components/refresh/refresh.js
Normal file
@ -0,0 +1,227 @@
|
||||
// components/refresh/refresh.js
|
||||
|
||||
const app = getApp()
|
||||
|
||||
Component({
|
||||
properties: {
|
||||
// 加载中
|
||||
requesting: {
|
||||
type: Boolean,
|
||||
value: false,
|
||||
observer: 'requestingEnd',
|
||||
},
|
||||
scrollTop: {
|
||||
type: Number,
|
||||
value: 0,
|
||||
},
|
||||
// 加载完毕
|
||||
end: {
|
||||
type: Boolean,
|
||||
value: false,
|
||||
},
|
||||
// 控制空状态的显示
|
||||
emptyShow: {
|
||||
type: Boolean,
|
||||
value: false,
|
||||
},
|
||||
// 当前列表长度
|
||||
listCount: {
|
||||
type: Number,
|
||||
value: 0,
|
||||
},
|
||||
// 空状态的图片
|
||||
emptyUrl: {
|
||||
type: String,
|
||||
value: "/assets/image/empty/empty.png"
|
||||
},
|
||||
// 空状态的文字提示
|
||||
emptyText: {
|
||||
type: String,
|
||||
value: "未找到数据"
|
||||
},
|
||||
// 是否有header
|
||||
hasTop: {
|
||||
type: Boolean,
|
||||
value: false
|
||||
},
|
||||
// 下拉刷新的高度
|
||||
refreshSize: {
|
||||
type: Number,
|
||||
value: 90,
|
||||
observer: 'refreshChange'
|
||||
},
|
||||
// 底部高度
|
||||
bottomSize: {
|
||||
type: Number,
|
||||
value: 0,
|
||||
},
|
||||
// 颜色
|
||||
color: {
|
||||
type: String,
|
||||
value: ""
|
||||
},
|
||||
// iOS点击顶部状态栏、安卓双击标题栏时,滚动条返回顶部,只支持竖向
|
||||
enableBackToTop: {
|
||||
type: Boolean,
|
||||
value: false
|
||||
}
|
||||
},
|
||||
data: {
|
||||
StatusBar: app.globalData.StatusBar,
|
||||
CustomBar: app.globalData.CustomBar,
|
||||
Custom: app.globalData.Custom,
|
||||
/* 未渲染数据 */
|
||||
mode: 'refresh', // refresh 和 more 两种模式
|
||||
successShow: false, // 显示success
|
||||
successTran: false, // 过度success
|
||||
refreshStatus: 1, // 1: 下拉刷新, 2: 松开更新, 3: 加载中, 4: 加载完成
|
||||
move: -45, // movable-view 偏移量
|
||||
scrollHeight1: 0, // refresh view 高度负值
|
||||
scrollHeight2: 0, // refresh view - success view 高度负值
|
||||
timer: null,
|
||||
|
||||
/* 渲染数据 */
|
||||
// scrollTop: 0,
|
||||
overOnePage: false
|
||||
},
|
||||
methods: {
|
||||
/**
|
||||
* 处理 bindscrolltolower 失效情况
|
||||
*/
|
||||
scroll(e) {
|
||||
// 可以触发滚动表示超过一屏
|
||||
this.setData({
|
||||
overOnePage: true
|
||||
});
|
||||
clearTimeout(this.data.timer);
|
||||
this.setData({
|
||||
timer: setTimeout(() => {
|
||||
this.setData({
|
||||
scrollTop: e.detail.scrollTop
|
||||
})
|
||||
}, 100)
|
||||
});
|
||||
this.triggerEvent('scroll',e);
|
||||
},
|
||||
/**
|
||||
* movable-view 滚动监听
|
||||
*/
|
||||
change(e) {
|
||||
let refreshStatus = this.data.refreshStatus,
|
||||
diff = e.detail.y;
|
||||
|
||||
if (refreshStatus >= 3) return;
|
||||
|
||||
if (diff > -10) {
|
||||
this.setData({
|
||||
refreshStatus: 2
|
||||
});
|
||||
} else {
|
||||
this.setData({
|
||||
refreshStatus: 1
|
||||
});
|
||||
}
|
||||
},
|
||||
/**
|
||||
* movable-view 触摸结束事件
|
||||
*/
|
||||
touchend() {
|
||||
let refreshStatus = this.data.refreshStatus;
|
||||
|
||||
if (refreshStatus >= 3) return;
|
||||
|
||||
if (refreshStatus === 2) {
|
||||
wx.vibrateShort();
|
||||
this.setData({
|
||||
refreshStatus: 3,
|
||||
move: 0,
|
||||
mode: 'refresh'
|
||||
});
|
||||
this.triggerEvent('refresh');
|
||||
} else if (refreshStatus === 1) {
|
||||
this.setData({
|
||||
move: this.data.scrollHeight1
|
||||
});
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 加载更多
|
||||
*/
|
||||
more() {
|
||||
if (!this.properties.end) {
|
||||
this.setData({
|
||||
mode: 'more'
|
||||
});
|
||||
this.triggerEvent('more');
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 监听 requesting 字段变化, 来处理下拉刷新对应的状态变化
|
||||
*/
|
||||
requestingEnd(newVal, oldVal) {
|
||||
if (this.data.mode === 'more') return;
|
||||
|
||||
if (oldVal === true && newVal === false) {
|
||||
setTimeout(() => {
|
||||
this.setData({
|
||||
successShow: true,
|
||||
refreshStatus: 4,
|
||||
move: this.data.scrollHeight2
|
||||
});
|
||||
setTimeout(() => {
|
||||
this.setData({
|
||||
successTran: true,
|
||||
move: this.data.scrollHeight1
|
||||
});
|
||||
setTimeout(() => {
|
||||
this.setData({
|
||||
refreshStatus: 1,
|
||||
successShow: false,
|
||||
successTran: false,
|
||||
move: this.data.scrollHeight1
|
||||
});
|
||||
}, 10)
|
||||
}, 10)
|
||||
}, 600)
|
||||
} else {
|
||||
if (this.data.refreshStatus !== 3) {
|
||||
this.setData({
|
||||
refreshStatus: 3,
|
||||
move: 0
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 监听下拉刷新高度变化, 如果改变重新初始化参数, 最小高度80rpx
|
||||
*/
|
||||
refreshChange(newVal, oldVal) {
|
||||
if (newVal <= 80) {
|
||||
this.setData({
|
||||
refreshSize: 80
|
||||
});
|
||||
}
|
||||
// 异步加载数据时候, 延迟执行 init 方法, 防止基础库 2.7.1 版本及以下无法正确获取 dom 信息
|
||||
setTimeout(() => this.init(), 10);
|
||||
},
|
||||
/**
|
||||
* 初始化scroll组件参数, 动态获取 下拉刷新区域 和 success 的高度
|
||||
*/
|
||||
init() {
|
||||
let {
|
||||
windowWidth
|
||||
} = wx.getSystemInfoSync();
|
||||
let successHeight = (windowWidth || 375) / 750 * 70;
|
||||
|
||||
this.createSelectorQuery().select("#refresh").boundingClientRect((res) => {
|
||||
this.setData({
|
||||
scrollHeight1: -res.height,
|
||||
scrollHeight2: successHeight - res.height
|
||||
});
|
||||
}).exec();
|
||||
},
|
||||
},
|
||||
ready() {
|
||||
this.init();
|
||||
}
|
||||
});
|
4
components/refresh/refresh.json
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {}
|
||||
}
|
43
components/refresh/refresh.wxml
Normal file
@ -0,0 +1,43 @@
|
||||
<view>
|
||||
<movable-area class="movable-area">
|
||||
<movable-view class="scroll"
|
||||
bind:change="change"
|
||||
bind:touchend="touchend"
|
||||
direction="vertical"
|
||||
disabled="{{refreshStatus >= 3}}"
|
||||
y='{{move}}'>
|
||||
<scroll-view class="scroll__view"
|
||||
style="padding-top: {{ hasTop ? refreshSize : 0}}rpx;"
|
||||
scroll-y="{{refreshStatus == 1}}"
|
||||
bindscroll="scroll"
|
||||
scroll-top="{{scrollTop}}"
|
||||
enable-back-to-top="{{enableBackToTop}}"
|
||||
lower-threshold="{{80}}rpx"
|
||||
bindscrolltolower="more">
|
||||
<view id="refresh" class="scroll__refresh {{successShow ? 'scroll__refresh--hidden' : ''}}" style="height: {{refreshSize}}rpx;padding: 20rpx 0;">
|
||||
<view class="scroll__loading">
|
||||
<view wx:if="{{refreshStatus == 1 || refreshStatus == 2}}" class="{{refreshStatus == 2 ? 'rotate' : ''}} arrow"></view>
|
||||
<view wx:if="{{refreshStatus == 3}}" class="loading">
|
||||
<view class="loading__item"></view>
|
||||
<view class="loading__item"></view>
|
||||
<view class="loading__item"></view>
|
||||
<view class="loading__item"></view>
|
||||
<view class="loading__item"></view>
|
||||
<view class="loading__item"></view>
|
||||
<view class="loading__item"></view>
|
||||
<view class="loading__item"></view>
|
||||
<view class="loading__item"></view>
|
||||
<view class="loading__item"></view>
|
||||
<view class="loading__item"></view>
|
||||
<view class="loading__item"></view>
|
||||
</view>
|
||||
<view class="text" wx:if="{{refreshStatus == 1}}">下拉刷新</view>
|
||||
<view class="text" wx:elif="{{refreshStatus == 2}}">松开更新</view>
|
||||
<view class="text" wx:elif="{{refreshStatus == 3}}">加载中...</view>
|
||||
</view>
|
||||
</view>
|
||||
<slot></slot>
|
||||
</scroll-view>
|
||||
</movable-view>
|
||||
</movable-area>
|
||||
</view>
|
292
components/refresh/refresh.wxss
Normal file
@ -0,0 +1,292 @@
|
||||
.movable-area {
|
||||
width: 100%;
|
||||
height: 100vh;
|
||||
}
|
||||
|
||||
.scroll {
|
||||
width: 100%;
|
||||
height: calc(100vh + 90rpx);
|
||||
}
|
||||
|
||||
.scroll__view {
|
||||
height: 100%;
|
||||
position: relative;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.scroll__refresh {
|
||||
height: 90rpx;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.scroll__refresh--hidden {
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
.scroll__bottom {
|
||||
position: relative;
|
||||
height: 40rpx;
|
||||
padding: 40rpx 0;
|
||||
}
|
||||
|
||||
.scroll__loading {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 0;
|
||||
right: 0;
|
||||
transform: translateY(-50%);
|
||||
text-align: center;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.scroll__loading .text {
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
margin-left: 40rpx;
|
||||
}
|
||||
|
||||
.success {
|
||||
position: absolute;
|
||||
z-index: 9;
|
||||
top: 20rpx;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 70rpx;
|
||||
line-height: 70rpx;
|
||||
font-size: 24rpx;
|
||||
text-align: center;
|
||||
opacity: 0;
|
||||
transform: scale(0);
|
||||
color: #3f82fd;
|
||||
}
|
||||
|
||||
.success:after {
|
||||
content: " ";
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: currentColor;
|
||||
opacity: 0.7;
|
||||
transform: scaleX(0);
|
||||
transition: transform 0.3s ease-in-out;
|
||||
z-index: 0;
|
||||
}
|
||||
|
||||
.success > .info {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: 1;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.success--show {
|
||||
opacity: 1;
|
||||
transform: scale(1);
|
||||
}
|
||||
|
||||
.success--show:after {
|
||||
transform: scaleX(1);
|
||||
}
|
||||
|
||||
.success--tran {
|
||||
opacity: 0;
|
||||
transform: translateY(-100%);
|
||||
transition: opacity 0.35s linear, transform 0.35s linear;
|
||||
}
|
||||
|
||||
.empty {
|
||||
padding: 30rpx;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.empty__image {
|
||||
width: 200rpx;
|
||||
height: 200rpx;
|
||||
margin: 160rpx auto 60rpx;
|
||||
}
|
||||
|
||||
.empty__text {
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.arrow {
|
||||
position: relative;
|
||||
border-radius: 4rpx;
|
||||
width: 4rpx;
|
||||
height: 30rpx;
|
||||
background: #a5a5a5;
|
||||
transition: transform 0.15s ease-in-out;
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.arrow:before {
|
||||
position: absolute;
|
||||
content: "";
|
||||
bottom: -4rpx;
|
||||
right: 50%;
|
||||
width: 4rpx;
|
||||
height: 16rpx;
|
||||
transform: rotate(45deg);
|
||||
transform-origin: 100% 100%;
|
||||
background: #a5a5a5;
|
||||
border-radius: 4rpx;
|
||||
}
|
||||
|
||||
.arrow:after {
|
||||
position: absolute;
|
||||
content: "";
|
||||
bottom: -4rpx;
|
||||
left: 50%;
|
||||
width: 4rpx;
|
||||
height: 16rpx;
|
||||
transform: rotate(-45deg);
|
||||
transform-origin: 0% 100%;
|
||||
background: #a5a5a5;
|
||||
border-radius: 4rpx;
|
||||
}
|
||||
|
||||
.arrow.rotate {
|
||||
transform: rotate(-180deg);
|
||||
}
|
||||
|
||||
.loading {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
width: 36rpx;
|
||||
height: 36rpx;
|
||||
margin-right: -14rpx;
|
||||
}
|
||||
|
||||
.loading__item {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 36rpx;
|
||||
height: 36rpx;
|
||||
}
|
||||
|
||||
.loading__item:before {
|
||||
content: "";
|
||||
display: block;
|
||||
margin: 0 auto;
|
||||
width: 4rpx;
|
||||
height: 8rpx;
|
||||
background-color: #a5a5a5;
|
||||
border-radius: 4rpx;
|
||||
animation: fadeDelay 1.2s infinite ease-in-out both;
|
||||
}
|
||||
|
||||
.loading__item:nth-child(2) {
|
||||
transform: rotate(30deg);
|
||||
}
|
||||
|
||||
.loading__item:nth-child(2):before {
|
||||
animation-delay: -1.1s;
|
||||
}
|
||||
|
||||
.loading__item:nth-child(3) {
|
||||
transform: rotate(60deg);
|
||||
}
|
||||
|
||||
.loading__item:nth-child(3):before {
|
||||
animation-delay: -1s;
|
||||
}
|
||||
|
||||
.loading__item:nth-child(4) {
|
||||
transform: rotate(90deg);
|
||||
}
|
||||
|
||||
.loading__item:nth-child(4):before {
|
||||
animation-delay: -0.9s;
|
||||
}
|
||||
|
||||
.loading__item:nth-child(5) {
|
||||
transform: rotate(120deg);
|
||||
}
|
||||
|
||||
.loading__item:nth-child(5):before {
|
||||
animation-delay: -0.8s;
|
||||
}
|
||||
|
||||
.loading__item:nth-child(6) {
|
||||
transform: rotate(150deg);
|
||||
}
|
||||
|
||||
.loading__item:nth-child(6):before {
|
||||
animation-delay: -0.7s;
|
||||
}
|
||||
|
||||
.loading__item:nth-child(7) {
|
||||
transform: rotate(180deg);
|
||||
}
|
||||
|
||||
.loading__item:nth-child(7):before {
|
||||
animation-delay: -0.6s;
|
||||
}
|
||||
|
||||
.loading__item:nth-child(8) {
|
||||
transform: rotate(210deg);
|
||||
}
|
||||
|
||||
.loading__item:nth-child(8):before {
|
||||
animation-delay: -0.5s;
|
||||
}
|
||||
|
||||
.loading__item:nth-child(9) {
|
||||
transform: rotate(240deg);
|
||||
}
|
||||
|
||||
.loading__item:nth-child(9):before {
|
||||
animation-delay: -0.4s;
|
||||
}
|
||||
|
||||
.loading__item:nth-child(10) {
|
||||
transform: rotate(270deg);
|
||||
}
|
||||
|
||||
.loading__item:nth-child(10):before {
|
||||
animation-delay: -0.3s;
|
||||
}
|
||||
|
||||
.loading__item:nth-child(11) {
|
||||
transform: rotate(300deg);
|
||||
}
|
||||
|
||||
.loading__item:nth-child(11):before {
|
||||
animation-delay: -0.2s;
|
||||
}
|
||||
|
||||
.loading__item:nth-child(12) {
|
||||
transform: rotate(330deg);
|
||||
}
|
||||
|
||||
.loading__item:nth-child(12):before {
|
||||
animation-delay: -0.1s;
|
||||
}
|
||||
|
||||
@keyframes fadeDelay {
|
||||
0%, 39%, 100% {
|
||||
opacity: 0.2;
|
||||
}
|
||||
|
||||
40% {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
@-webkit-keyframes fadeDelay {
|
||||
0%, 39%, 100% {
|
||||
opacity: 0.2;
|
||||
}
|
||||
|
||||
40% {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
29
components/study/study.js
Normal file
@ -0,0 +1,29 @@
|
||||
// components/study/study.js
|
||||
const app = getApp()
|
||||
|
||||
Component({
|
||||
/**
|
||||
* 组件的属性列表
|
||||
*/
|
||||
properties: {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 组件的初始数据
|
||||
*/
|
||||
data: {
|
||||
windowWidth: app.globalData.windowWidth,
|
||||
},
|
||||
|
||||
/**
|
||||
* 组件的方法列表
|
||||
*/
|
||||
methods: {
|
||||
onClick(event){
|
||||
wx.navigateTo({
|
||||
url: '/page_package/study/study'
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
4
components/study/study.json
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {}
|
||||
}
|
28
components/study/study.wxml
Normal file
@ -0,0 +1,28 @@
|
||||
<!--components/study/study.wxml-->
|
||||
<!--<view style="width: 100%;background-color: white">-->
|
||||
<!-- <view class="skill margin-top-sm margin-left-sm font-w600 color-main">赚钱技巧</view>-->
|
||||
<!-- <view class="padding-sm flex-column" style="border-bottom: 1px solid #f2f2f2;" wx:for="{{3}}"-->
|
||||
<!-- bindtap="onClick"-->
|
||||
<!-- data-item="{{item}}"-->
|
||||
<!-- wx:key="*this">-->
|
||||
<!-- <view class="color3 font-w600">招商+入门+冲刺官方系统培训课程</view>-->
|
||||
<!-- <view class="flex-row margin-top-sm">-->
|
||||
<!-- <image src="https://img10.360buyimg.com/N12/s735x363_jfs/t1/24216/14/2036/168900/5c189d14E7100fbf7/371fcad2d783e8ca.jpg"-->
|
||||
<!-- style="border-radius: 8rpx;height: 96px;width: 270rpx;"></image>-->
|
||||
<!-- <view class="flex-column margin-left-sm" style="width: calc(100vw - 300rpx)">-->
|
||||
<!-- <text class="font26 color6"-->
|
||||
<!-- style="line-height: 34rpx">惠享主力就业计划特别课,集招商、入门、提升的综合进阶培训,主力更多人创收!-->
|
||||
<!-- </text>-->
|
||||
<!-- <view class="cu-btn bg-gradual-main round font24 flex-row flex-center margin-top-sm"-->
|
||||
<!-- style="width: 84px;height: 24px">去学习-->
|
||||
<!-- <text class="cuIcon-right"/>-->
|
||||
<!-- </view>-->
|
||||
<!-- </view>-->
|
||||
<!-- </view>-->
|
||||
<!-- </view>-->
|
||||
<!--</view>-->
|
||||
|
||||
<view class="column text-center" style="margin-top: 50%">
|
||||
<view class="cuIcon-discoverfill color-main" style="font-size: 84rpx"></view>
|
||||
<view class="color6 font31 margin-top">小编正在整理中</view>
|
||||
</view>
|
11
components/study/study.wxss
Normal file
@ -0,0 +1,11 @@
|
||||
/* components/study/study.wxss */
|
||||
@import "../../utils/styles/main.wxss";
|
||||
@import "../../utils/styles/icon.wxss";
|
||||
@import "../../utils/styles/animation.wxss";
|
||||
@import "../../utils/styles/base.wxss";
|
||||
|
||||
.skill{
|
||||
border-left: 8rpx solid #f43f3b;
|
||||
padding: 4rpx 8rpx;
|
||||
|
||||
}
|
385
components/video-swiper/video-swiper.js
Normal file
@ -0,0 +1,385 @@
|
||||
// components/video-swiper/video-swiper.js
|
||||
const app = getApp()
|
||||
module.exports =
|
||||
/******/
|
||||
(function(modules) { // webpackBootstrap
|
||||
/******/ // The module cache
|
||||
/******/
|
||||
var installedModules = {};
|
||||
/******/
|
||||
/******/ // The require function
|
||||
/******/
|
||||
function __webpack_require__(moduleId) {
|
||||
/******/
|
||||
/******/ // Check if module is in cache
|
||||
/******/
|
||||
if (installedModules[moduleId]) {
|
||||
/******/
|
||||
return installedModules[moduleId].exports;
|
||||
/******/
|
||||
}
|
||||
/******/ // Create a new module (and put it into the cache)
|
||||
/******/
|
||||
var module = installedModules[moduleId] = {
|
||||
/******/
|
||||
i: moduleId,
|
||||
/******/
|
||||
l: false,
|
||||
/******/
|
||||
exports: {}
|
||||
/******/
|
||||
};
|
||||
/******/
|
||||
/******/ // Execute the module function
|
||||
/******/
|
||||
modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
||||
/******/
|
||||
/******/ // Flag the module as loaded
|
||||
/******/
|
||||
module.l = true;
|
||||
/******/
|
||||
/******/ // Return the exports of the module
|
||||
/******/
|
||||
return module.exports;
|
||||
/******/
|
||||
}
|
||||
/******/
|
||||
/******/
|
||||
/******/ // expose the modules object (__webpack_modules__)
|
||||
/******/
|
||||
__webpack_require__.m = modules;
|
||||
/******/
|
||||
/******/ // expose the module cache
|
||||
/******/
|
||||
__webpack_require__.c = installedModules;
|
||||
/******/
|
||||
/******/ // define getter function for harmony exports
|
||||
/******/
|
||||
__webpack_require__.d = function(exports, name, getter) {
|
||||
/******/
|
||||
if (!__webpack_require__.o(exports, name)) {
|
||||
/******/
|
||||
Object.defineProperty(exports, name, {
|
||||
enumerable: true,
|
||||
get: getter
|
||||
});
|
||||
/******/
|
||||
}
|
||||
/******/
|
||||
};
|
||||
/******/
|
||||
/******/ // define __esModule on exports
|
||||
/******/
|
||||
__webpack_require__.r = function(exports) {
|
||||
/******/
|
||||
if (typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
||||
/******/
|
||||
Object.defineProperty(exports, Symbol.toStringTag, {
|
||||
value: 'Module'
|
||||
});
|
||||
/******/
|
||||
}
|
||||
/******/
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
/******/
|
||||
};
|
||||
/******/
|
||||
/******/ // create a fake namespace object
|
||||
/******/ // mode & 1: value is a module id, require it
|
||||
/******/ // mode & 2: merge all properties of value into the ns
|
||||
/******/ // mode & 4: return value when already ns object
|
||||
/******/ // mode & 8|1: behave like require
|
||||
/******/
|
||||
__webpack_require__.t = function(value, mode) {
|
||||
/******/
|
||||
if (mode & 1) value = __webpack_require__(value);
|
||||
/******/
|
||||
if (mode & 8) return value;
|
||||
/******/
|
||||
if ((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
|
||||
/******/
|
||||
var ns = Object.create(null);
|
||||
/******/
|
||||
__webpack_require__.r(ns);
|
||||
/******/
|
||||
Object.defineProperty(ns, 'default', {
|
||||
enumerable: true,
|
||||
value: value
|
||||
});
|
||||
/******/
|
||||
if (mode & 2 && typeof value != 'string')
|
||||
for (var key in value) __webpack_require__.d(ns, key, function(key) {
|
||||
return value[key];
|
||||
}.bind(null, key));
|
||||
/******/
|
||||
return ns;
|
||||
/******/
|
||||
};
|
||||
/******/
|
||||
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
||||
/******/
|
||||
__webpack_require__.n = function(module) {
|
||||
/******/
|
||||
var getter = module && module.__esModule ?
|
||||
/******/
|
||||
function getDefault() {
|
||||
return module['default'];
|
||||
} :
|
||||
/******/
|
||||
function getModuleExports() {
|
||||
return module;
|
||||
};
|
||||
/******/
|
||||
__webpack_require__.d(getter, 'a', getter);
|
||||
/******/
|
||||
return getter;
|
||||
/******/
|
||||
};
|
||||
/******/
|
||||
/******/ // Object.prototype.hasOwnProperty.call
|
||||
/******/
|
||||
__webpack_require__.o = function(object, property) {
|
||||
return Object.prototype.hasOwnProperty.call(object, property);
|
||||
};
|
||||
/******/
|
||||
/******/ // __webpack_public_path__
|
||||
/******/
|
||||
__webpack_require__.p = "";
|
||||
/******/
|
||||
/******/
|
||||
/******/ // Load entry module and return exports
|
||||
/******/
|
||||
return __webpack_require__(__webpack_require__.s = 0);
|
||||
/******/
|
||||
})
|
||||
/************************************************************************/
|
||||
/******/
|
||||
([
|
||||
/* 0 */
|
||||
/***/
|
||||
(function(module, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
|
||||
Component({
|
||||
options: {
|
||||
addGlobalClass: true,
|
||||
pureDataPattern: /^_/
|
||||
},
|
||||
properties: {
|
||||
duration: {
|
||||
type: Number,
|
||||
value: 500
|
||||
},
|
||||
easingFunction: {
|
||||
type: String,
|
||||
value: 'default'
|
||||
},
|
||||
current: {
|
||||
type: Number,
|
||||
value: 0
|
||||
},
|
||||
loop: {
|
||||
type: Boolean,
|
||||
value: true
|
||||
},
|
||||
videoList: {
|
||||
type: Object,
|
||||
value: {},
|
||||
observer: function observer() {
|
||||
var newVal = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
||||
this._videoListChanged(newVal.videos, newVal.current);
|
||||
}
|
||||
}
|
||||
},
|
||||
data: {
|
||||
nextQueue: [],
|
||||
prevQueue: [],
|
||||
curQueue: [],
|
||||
circular: false,
|
||||
_last: 1,
|
||||
_change: -1,
|
||||
_invalidUp: 0,
|
||||
_invalidDown: 0,
|
||||
_videoContexts: [],
|
||||
percent: 0,
|
||||
isPaly: false,
|
||||
currentIndex: 0,
|
||||
windowWidth: app.globalData.windowWidth,
|
||||
windowHeight: app.globalData.windowHeight,
|
||||
selectVideo: {
|
||||
id: 0,
|
||||
index: 0
|
||||
}
|
||||
},
|
||||
lifetimes: {
|
||||
attached: function attached() {
|
||||
this.data._videoContexts = [wx.createVideoContext('video_0', this), wx.createVideoContext('video_1', this), wx.createVideoContext('video_2', this)];
|
||||
this.setData({
|
||||
currentIndex: 0
|
||||
})
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
_videoListChanged: function _videoListChanged(newVal, current) {
|
||||
if (newVal == undefined) return
|
||||
var _this = this;
|
||||
|
||||
var data = this.data;
|
||||
newVal.forEach(function(item) {
|
||||
data.nextQueue.push(item);
|
||||
});
|
||||
if (data.curQueue.length === 0) {
|
||||
let postion = newVal.length - current
|
||||
if (postion >= 3)
|
||||
this.setData({
|
||||
curQueue: data.nextQueue.splice(current, 3)
|
||||
}, function() {
|
||||
_this.playCurrent(0);
|
||||
});
|
||||
else
|
||||
this.setData({
|
||||
curQueue: data.nextQueue.splice(current, postion)
|
||||
}, function() {
|
||||
_this.playCurrent(0);
|
||||
});
|
||||
}
|
||||
},
|
||||
animationfinish: function animationfinish(e) {
|
||||
var _data = this.data,
|
||||
_last = _data._last,
|
||||
_change = _data._change,
|
||||
curQueue = _data.curQueue,
|
||||
prevQueue = _data.prevQueue,
|
||||
nextQueue = _data.nextQueue;
|
||||
|
||||
var current = e.detail.current;
|
||||
var diff = current - _last;
|
||||
if (diff === 0) return;
|
||||
this.data._last = current;
|
||||
this.playCurrent(current);
|
||||
this.triggerEvent('change', {
|
||||
activeId: curQueue[current].id
|
||||
});
|
||||
var direction = diff === 1 || diff === -2 ? 'up' : 'down';
|
||||
if (direction === 'up') {
|
||||
if (this.data._invalidDown === 0) {
|
||||
var change = (_change + 1) % 3;
|
||||
var add = nextQueue.shift();
|
||||
var remove = curQueue[change];
|
||||
if (add) {
|
||||
prevQueue.push(remove);
|
||||
curQueue[change] = add;
|
||||
this.data._change = change;
|
||||
} else {
|
||||
this.data._invalidUp += 1;
|
||||
}
|
||||
} else {
|
||||
this.data._invalidDown -= 1;
|
||||
}
|
||||
}
|
||||
if (direction === 'down') {
|
||||
if (this.data._invalidUp === 0) {
|
||||
var _change2 = _change;
|
||||
var _remove = curQueue[_change2];
|
||||
var _add = prevQueue.pop();
|
||||
if (_add) {
|
||||
curQueue[_change2] = _add;
|
||||
nextQueue.unshift(_remove);
|
||||
this.data._change = (_change2 - 1 + 3) % 3;
|
||||
} else {
|
||||
this.data._invalidDown += 1;
|
||||
}
|
||||
} else {
|
||||
this.data._invalidUp -= 1;
|
||||
}
|
||||
}
|
||||
var circular = true;
|
||||
if (nextQueue.length === 0 && current !== 0) {
|
||||
circular = false;
|
||||
}
|
||||
if (prevQueue.length === 0 && current !== 2) {
|
||||
circular = false;
|
||||
}
|
||||
this.setData({
|
||||
curQueue: curQueue,
|
||||
circular: circular
|
||||
});
|
||||
},
|
||||
playCurrent: function playCurrent(current) {
|
||||
this.data._videoContexts.forEach(function(ctx, index) {
|
||||
index !== current ? ctx.pause() : ctx.play();
|
||||
});
|
||||
},
|
||||
onPlay: function onPlay(e) {
|
||||
this.trigger(e, 'play');
|
||||
this.setData({
|
||||
isPaly: true,
|
||||
selectVideo: {
|
||||
id: e.currentTarget.dataset.id,
|
||||
index: e.currentTarget.dataset.index
|
||||
}
|
||||
})
|
||||
},
|
||||
onPause: function onPause(e) {
|
||||
this.trigger(e, 'pause');
|
||||
this.setData({
|
||||
isPaly: false
|
||||
})
|
||||
},
|
||||
clickPause(e) {
|
||||
if (!this.data.isPaly)
|
||||
this.data._videoContexts[e.currentTarget.dataset.index].play()
|
||||
else
|
||||
this.data._videoContexts[e.currentTarget.dataset.index].pause()
|
||||
},
|
||||
onEnded: function onEnded(e) {
|
||||
this.trigger(e, 'ended');
|
||||
},
|
||||
onError: function onError(e) {
|
||||
this.trigger(e, 'error');
|
||||
},
|
||||
onTimeUpdate: function onTimeUpdate(e) {
|
||||
this.trigger(e, 'timeupdate');
|
||||
let percent = (e.detail.currentTime / e.detail.duration) * 100
|
||||
this.setData({
|
||||
percent: percent.toFixed(2)
|
||||
})
|
||||
},
|
||||
onWaiting: function onWaiting(e) {
|
||||
this.trigger(e, 'wait');
|
||||
},
|
||||
goUserHome: function goUserHome(e) {
|
||||
this.trigger(e, 'user');
|
||||
},
|
||||
likeVideoOrNot: function likeVideoOrNot(e) {
|
||||
this.trigger(e, 'like');
|
||||
},
|
||||
showComments: function showComments(e) {
|
||||
this.trigger(e, 'comments');
|
||||
},
|
||||
shareMe: function shareMe(e) {
|
||||
this.triggerEvent('share', this.data.selectVideo, {})
|
||||
},
|
||||
onProgress: function onProgress(e) {
|
||||
this.trigger(e, 'progress');
|
||||
},
|
||||
onLoadedMetaData: function onLoadedMetaData(e) {
|
||||
this.trigger(e, 'loadedmetadata');
|
||||
},
|
||||
trigger: function trigger(e, type) {
|
||||
var ext = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
||||
|
||||
var detail = e.detail;
|
||||
var activeId = e.target.dataset.id;
|
||||
this.triggerEvent(type, Object.assign(Object.assign(Object.assign({}, detail), {
|
||||
activeId: activeId
|
||||
}), ext));
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
]);
|
4
components/video-swiper/video-swiper.json
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {}
|
||||
}
|
59
components/video-swiper/video-swiper.wxml
Normal file
@ -0,0 +1,59 @@
|
||||
<!--components/video-swiper/video-swiper.wxml-->
|
||||
<view class="container">
|
||||
<swiper class="video-swiper" circular="{{circular}}" easing-function="{{easingFunction}}" vertical current="0" duration="{{duration}}" bindanimationfinish="animationfinish" style="width:{{windowWidth}}px;height:{{windowHeight}}px">
|
||||
<!-- curQueue 循环会导致video重新插入,objectFit 不可变更 -->
|
||||
<swiper-item wx:for="{{curQueue}}" wx:key="*this" style="width:{{windowWidth}}px;height:{{windowHeight}}px">
|
||||
<video id="video_{{index}}" class="video_item" loop="{{loop}}" enable-play-gesture enable-progress-gesture show-center-play-btn="{{false}}" controls="{{false}}" src="{{item.videoUrl}}" data-id="{{item.id}}" object-fit="{{'cover'}}" data-index="{{index}}" bindplay="onPlay"
|
||||
bindpause="onPause" bindended="onEnded" binderror="onError" bindtimeupdate="onTimeUpdate" bindwaiting="onWaiting" bindprogress="onProgress" bindloadedmetadata="onLoadedMetaData" poster="{{item.coverUrl}}"
|
||||
bindtap="clickPause">
|
||||
</video>
|
||||
|
||||
<view class="tools flex-column flex-center">
|
||||
<!-- 用户头像 -->
|
||||
<view class='user-image'>
|
||||
<image class="userinfo-avatar" catchtap='goUserHome' src="{{item.coverUrl}}"></image>
|
||||
<!-- <cover-image class="userinfo-add" wx:if="{{(!isMe)&&(!isfans)}}" src="../resource/images/add.png" catchtap='addFans'></cover-image> -->
|
||||
<!-- <cover-image class="userinfo-add" wx:if="{{(!isMe)&&(isfans)}}" src="../resource/images/guanzhu.png" catchtap='deleteFans'></cover-image> -->
|
||||
</view>
|
||||
<!-- 点赞 -->
|
||||
<view catchtap="likeVideoOrNot">
|
||||
<view class="cuIcon-emojifill font64 color-white" wx:if="{{userLikeVideo}}"></view>
|
||||
<view class="cuIcon-emojifill font64 color-white" wx:else></view>
|
||||
<view class="text margin-top-xs color-white">{{item.visitCount}}</view>
|
||||
</view>
|
||||
<!-- 评论 -->
|
||||
<view catchtap='showComments' class="margin-top color-white">
|
||||
<view class="cuIcon-writefill font64 " bindtap="leaveComment"></view>
|
||||
<view class="text margin-top-xs ">{{item.seconds}}</view>
|
||||
</view>
|
||||
<!-- 分享 -->
|
||||
<view class="margin-top">
|
||||
<view class="cuIcon-share color-white font64" bindtap='shareMe' ></view>
|
||||
</view>
|
||||
</view>
|
||||
<progress class="progress" percent="{{percent}}" activeColor="#ffffff" backgroundColor="#A9A9A9" stroke-width="1" />
|
||||
|
||||
|
||||
<!-- 视频描述 -->
|
||||
<view class='container-words flex-column '>
|
||||
<view class="font31 font-w600">@佰创科技</view>
|
||||
<view class='video-desc font30 margin-top-xs'>我是视频标题 我是视频标题</view>
|
||||
|
||||
<view class="flex-row video-ad margin-top-xs" style="width:{{windowWidth*.5}}px">
|
||||
<image src="https://m.360buyimg.com/common/s310x310_jfs/t1/88050/34/9712/99144/5e12a0deE27ce2623/ef351b2dcc1a127c.jpg" class="ad-img"></image>
|
||||
<view class="flex-column margin-left-xs">
|
||||
<view class="flex-row">
|
||||
<!-- <view>京东</view> -->
|
||||
<view class="color3">商品名字</view>
|
||||
</view>
|
||||
<view class="flex-row margin-top flex-center">
|
||||
<view class="font22 color-main">¥29.99</view>
|
||||
<view style="text-decoration:line-through" class="font20 color6">¥36.99</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- <view class="cuIcon-videofill font64 color6 play-btn" wx:if="{{!isPaly}}"></view> -->
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
</view>
|
67
components/video-swiper/video-swiper.wxss
Normal file
@ -0,0 +1,67 @@
|
||||
/* components/video-swiper/video-swiper.wxss */
|
||||
|
||||
.container {
|
||||
height: 100vh;
|
||||
width: 100vw;
|
||||
}
|
||||
|
||||
.video-swiper {
|
||||
height: 100vh;
|
||||
width: 100vw;
|
||||
margin-top: -400rpx
|
||||
}
|
||||
|
||||
.video_item {
|
||||
height: 100vh;
|
||||
width: 100vw;
|
||||
}
|
||||
|
||||
.progress {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
bottom: 30px;
|
||||
height: 4px;
|
||||
width: 100vw;
|
||||
}
|
||||
|
||||
|
||||
/* 右侧区域 */
|
||||
.tools {
|
||||
position: absolute;
|
||||
right: 20rpx;
|
||||
top: 50%;
|
||||
}
|
||||
|
||||
/* 头像 */
|
||||
.userinfo-avatar {
|
||||
width: 100rpx;
|
||||
height: 100rpx;
|
||||
margin: 20rpx;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.container-words {
|
||||
position: absolute;
|
||||
bottom: 50px;
|
||||
left: 20rpx;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.video-ad{
|
||||
height: 128rpx;
|
||||
background-color: rgba(252, 252, 252, 0.9);
|
||||
border-radius: 8rpx;
|
||||
}
|
||||
|
||||
.ad-img{
|
||||
width: 128rpx;
|
||||
height: 128rpx;
|
||||
|
||||
}
|
||||
|
||||
.play-btn {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%,-50%);
|
||||
}
|
50
custom-tab-bar/index.js
Normal file
@ -0,0 +1,50 @@
|
||||
Component({
|
||||
data: {
|
||||
selected: 0,
|
||||
color: "#7A7E83",
|
||||
selectedColor: "#f43f3b",
|
||||
list: [
|
||||
{
|
||||
pagePath: "/pages/index/index",
|
||||
iconPath: "/images/ic_tab_home.png",
|
||||
selectedIconPath: "/images/ic_tab_home_cur.png",
|
||||
text: "首页"
|
||||
},
|
||||
{
|
||||
pagePath: "/pages/sort/sort",
|
||||
iconPath: "/images/ic_tab_daren.png",
|
||||
selectedIconPath: "/images/ic_tab_daren_cur.png",
|
||||
text: "分类"
|
||||
},
|
||||
{
|
||||
pagePath: "/pages/vip/vip",
|
||||
iconPath: "/images/ic_tab_vip.png",
|
||||
selectedIconPath: "/images/ic_tab_vip_cur.png",
|
||||
text: "会员"
|
||||
},
|
||||
{
|
||||
pagePath: "/pages/strategy/strategy",
|
||||
iconPath: "/images/ic_tab_strategy.png",
|
||||
selectedIconPath: "/images/ic_tab_strategy_cur.png",
|
||||
text: "攻略"
|
||||
},
|
||||
{
|
||||
pagePath: "/pages/mine/mine",
|
||||
iconPath: "/images/ic_tab_mine.png",
|
||||
selectedIconPath: "/images/ic_tab_mine_cur.png",
|
||||
text: "我的"
|
||||
}
|
||||
],
|
||||
|
||||
},
|
||||
methods: {
|
||||
switchTab(e) {
|
||||
const data = e.currentTarget.dataset
|
||||
const url = data.path
|
||||
wx.switchTab({url})
|
||||
this.setData({
|
||||
selected: data.index
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
4
custom-tab-bar/index.json
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {}
|
||||
}
|
35
custom-tab-bar/index.wxml
Normal file
@ -0,0 +1,35 @@
|
||||
<!-- 底部导航栏 -->
|
||||
<view class="cu-bar tabbar bg-white foot" style="background-color: white">
|
||||
<view class="action" data-path="/pages/main-two/main-two" data-index="0" bindtap="switchTab">
|
||||
<view class='cuIcon-cu-image'>
|
||||
<!-- <image src="/images/ic_tab_home{{selected==0?'_cur':''}}.png"></image>-->
|
||||
<view class="cuIcon-homefill {{selected==0?'color-main':'colora'}}"></view>
|
||||
</view>
|
||||
<view class="{{selected==0?'color-main':'colora'}} font-w600" >首页</view>
|
||||
</view>
|
||||
<view class="action" data-path="/pages/sort/sort" data-index="1" bindtap="switchTab">
|
||||
<view class='cuIcon-cu-image'>
|
||||
<!-- <image src="/images/ic_tab_daren{{selected==1?'_cur':''}}.png"></image>-->
|
||||
<view class="cuIcon-shopfill {{selected==1?'color-main':'colora'}}"></view>
|
||||
</view>
|
||||
<view class="{{selected==1?'color-main':'colora'}} font-w600">分类</view>
|
||||
</view>
|
||||
<view class="action add-action" data-path="/pages/vip/vip" data-index="2" bindtap="switchTab">
|
||||
<view class='cuIcon-cu-image shadow'>
|
||||
<image src="/images/ic_tab_vip{{selected==2?'_cur':''}}.png" style="width:64rpx;height:64rpx"></image>
|
||||
</view>
|
||||
<view class="{{selected==2?'color-main':'colora'}} font-w600">会员</view>
|
||||
</view>
|
||||
<view class="action" data-path="/pages/strategy/strategy" data-index="3" bindtap="switchTab">
|
||||
<view class='cuIcon-cu-image'>
|
||||
<image src="/images/ic_tab_strategy{{selected==3?'_cur':''}}.png"/>
|
||||
</view>
|
||||
<view class="{{selected==3?'color-main':'colora'}} font-w600">攻略</view>
|
||||
</view>
|
||||
<view class="action" data-path="/pages/mine/mine" data-index="4" bindtap="switchTab">
|
||||
<view class='cuIcon-cu-image'>
|
||||
<image src="/images/ic_tab_mine{{selected==4?'_cur':''}}.png"/>
|
||||
</view>
|
||||
<view class="{{selected==4?'color-main':'colora'}} font-w600">我的</view>
|
||||
</view>
|
||||
</view>
|
4
custom-tab-bar/index.wxss
Normal file
@ -0,0 +1,4 @@
|
||||
@import "/utils/styles/main.wxss";
|
||||
@import "/utils/styles/icon.wxss";
|
||||
@import "/utils/styles/animation.wxss";
|
||||
@import "/utils/styles/base.wxss";
|
BIN
images/ic_camera.png
Normal file
After Width: | Height: | Size: 882 B |
BIN
images/ic_delivery.png
Normal file
After Width: | Height: | Size: 815 B |
BIN
images/ic_diamond.png
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
images/ic_fresh.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
images/ic_hot.png
Normal file
After Width: | Height: | Size: 1022 B |
BIN
images/ic_like.png
Normal file
After Width: | Height: | Size: 783 B |
BIN
images/ic_link.png
Normal file
After Width: | Height: | Size: 885 B |
BIN
images/ic_makeups.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
images/ic_search_bottom.png
Normal file
After Width: | Height: | Size: 238 B |
BIN
images/ic_search_bottom_cur.png
Normal file
After Width: | Height: | Size: 246 B |
BIN
images/ic_search_right.png
Normal file
After Width: | Height: | Size: 331 B |
BIN
images/ic_search_top.png
Normal file
After Width: | Height: | Size: 235 B |
BIN
images/ic_search_top_cur.png
Normal file
After Width: | Height: | Size: 249 B |
BIN
images/ic_share_btn.jpg
Normal file
After Width: | Height: | Size: 43 KiB |
BIN
images/ic_skirt.png
Normal file
After Width: | Height: | Size: 1016 B |
BIN
images/ic_tab_daren.png
Normal file
After Width: | Height: | Size: 847 B |
BIN
images/ic_tab_daren_cur.png
Normal file
After Width: | Height: | Size: 899 B |
BIN
images/ic_tab_home.png
Normal file
After Width: | Height: | Size: 659 B |
BIN
images/ic_tab_home_cur.png
Normal file
After Width: | Height: | Size: 709 B |
BIN
images/ic_tab_mine.png
Normal file
After Width: | Height: | Size: 570 B |
BIN
images/ic_tab_mine_cur.png
Normal file
After Width: | Height: | Size: 586 B |
BIN
images/ic_tab_strategy.png
Normal file
After Width: | Height: | Size: 659 B |
BIN
images/ic_tab_strategy_cur.png
Normal file
After Width: | Height: | Size: 705 B |
BIN
images/ic_tab_vip.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
images/ic_tab_vip_cur.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
images/ic_toothpaste.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
21
page_package/about/about.js
Normal file
@ -0,0 +1,21 @@
|
||||
// page_package/about/about.js
|
||||
const app = getApp()
|
||||
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
StatusBar: app.globalData.StatusBar,
|
||||
CustomBar: app.globalData.CustomBar,
|
||||
Custom: app.globalData.Custom,
|
||||
windowWidth: app.globalData.windowWidth,
|
||||
windowHeight: app.globalData.windowHeight,
|
||||
|
||||
},
|
||||
onLoad: function() {
|
||||
|
||||
}
|
||||
|
||||
})
|
8
page_package/about/about.json
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"navigationBarBackgroundColor": "#ffffff",
|
||||
"navigationBarTextStyle": "black",
|
||||
"navigationBarTitleText": "关于我们",
|
||||
"usingComponents": {
|
||||
"video-swiper":"/components/video-swiper/video-swiper"
|
||||
}
|
||||
}
|
10
page_package/about/about.wxml
Normal file
@ -0,0 +1,10 @@
|
||||
<!--page_package/about/about.wxml-->
|
||||
<!--<custom bgColor="bg-gradual-main" isBack="{{true}}">-->
|
||||
<!-- <view slot="backText">返回</view>-->
|
||||
<!-- <view slot="content" class="font-w600">关于尚橙</view>-->
|
||||
<!--</custom>-->
|
||||
<web-view src="https://u.jd.com/Satys8"/>
|
||||
|
||||
|
||||
|
||||
|
0
page_package/about/about.wxss
Normal file
211
page_package/activity/activity.js
Normal file
@ -0,0 +1,211 @@
|
||||
// page_package/activity/activity.js
|
||||
const app = getApp()
|
||||
const {activityByID, goodsConvert} = require('../../utils/network/services/service.js')
|
||||
const {productsCode} = require('../../utils/network/services/productImpl.js')
|
||||
const constants = require('../../utils/constants')
|
||||
const util = require('../../utils/util')
|
||||
const {onLogin} = require("../../utils/network/services/user.js")
|
||||
let that = null
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
windowWidth: app.globalData.windowWidth,
|
||||
activityContent: null,
|
||||
copyContent: '',
|
||||
copywriting: "1.复制以下文案并微信发送给自己\n2.通过微信访问活动地址购买",
|
||||
imgWidth: 0,
|
||||
imgHeight: 0,
|
||||
userInfo:null,
|
||||
ctx:null
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
wx.setNavigationBarTitle({title: options.title})
|
||||
that = this
|
||||
let width = this.data.windowWidth - 30
|
||||
this.setData({imgWidth: width, imgHeight: width + 128})
|
||||
|
||||
if (!app.globalData.loginStatus) {
|
||||
wx.showLoading({title: '加载中...'})
|
||||
// 登录
|
||||
wx.login({
|
||||
success: res => {
|
||||
onLogin(res.code)
|
||||
.then(res => {
|
||||
app.globalData.userInfo = res.data.data
|
||||
app.globalData.loginStatus = true
|
||||
util.setStorage(constants.AUTH_INFO, res.data.data)
|
||||
that.setData({userInfo: res.data.data})
|
||||
wx.showLoading({title: '加载中...'})
|
||||
that.getActivity(options)
|
||||
}).catch((err) => {
|
||||
if (err.data.code = 'USER_NOT_REGISTERED' && app.globalData.loginMode == 'true') {
|
||||
that.data.requesting = false
|
||||
that.setData({token: err.data.data.token})
|
||||
wx.navigateTo({url: '/pages/login/login?token=' + err.data.data.token})
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
} else
|
||||
that.getActivity(options)
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage: function () {
|
||||
|
||||
},
|
||||
onCopy() {
|
||||
if (this.data.copyContent)
|
||||
this.shareContent(this.data.copyContent)
|
||||
else
|
||||
goodsConvert(this.data.activityContent.content)
|
||||
.then(res => {
|
||||
this.setData({copyContent: res.data.data.content})
|
||||
this.shareContent(this.data.copyContent)
|
||||
}).catch(err => {
|
||||
wx.showToast({title: "获取推广链接失败", icon: "none"})
|
||||
})
|
||||
},
|
||||
shareContent(content) {
|
||||
wx.setClipboardData({
|
||||
data: content,
|
||||
success: function (res) {
|
||||
wx.getClipboardData({
|
||||
success: function (res) {
|
||||
wx.showToast({
|
||||
title: '复制成功'
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
goToIcon() {
|
||||
wx.previewImage({
|
||||
urls: [this.data.activityContent.shareImage],
|
||||
})
|
||||
},
|
||||
getActivity(options){
|
||||
activityByID(options.id)
|
||||
.then(res => {
|
||||
this.setData({
|
||||
activityContent: res.data.data
|
||||
})
|
||||
// this.imgLoad()
|
||||
}).catch(err => {
|
||||
// wx.hideLoading()
|
||||
wx.showToast({
|
||||
title: "活动加载失败",
|
||||
icon: "none",
|
||||
duration: 3000
|
||||
})
|
||||
})
|
||||
},
|
||||
imgLoad(){
|
||||
wx.showLoading({title: '加载中...'})
|
||||
Promise.all([
|
||||
new Promise((resolve, reject) => {
|
||||
wx.getImageInfo({
|
||||
src: that.data.userInfo.avatarUrl,
|
||||
success(res) {
|
||||
resolve(res)
|
||||
},
|
||||
fail(err) {
|
||||
reject(err)
|
||||
}
|
||||
})
|
||||
}),
|
||||
new Promise((resolve, reject) => {
|
||||
wx.getImageInfo({
|
||||
src: that.data.activityContent.shareImage,
|
||||
success(res) {
|
||||
resolve(res)
|
||||
},
|
||||
fail(err) {
|
||||
reject(err)
|
||||
}
|
||||
})
|
||||
}),
|
||||
// productsCode(data)
|
||||
// .then(res => {
|
||||
// let filePath = `${wx.env.USER_DATA_PATH}/${that.data.productDetails.skuId}${that.data.productDetails.inOrderCount30Days}`;
|
||||
// wx.getFileSystemManager().writeFile({
|
||||
// filePath: filePath,
|
||||
// data: wx.base64ToArrayBuffer(res.data.data.content),
|
||||
// encoding: 'binary',
|
||||
// success: () => {
|
||||
// resolve(filePath);
|
||||
// },
|
||||
// fail: err => {
|
||||
// reject(err);
|
||||
// },
|
||||
// });
|
||||
// }).catch((err) => {
|
||||
// reject(err);
|
||||
// })
|
||||
]).then(res => {
|
||||
const ctx = wx.createCanvasContext('myCanvas', that);
|
||||
ctx.fillStyle = "#FFFFFF";
|
||||
ctx.fillRect(0, 0, that.data.imgWidth, that.data.imgHeight);
|
||||
that.setData({ctx: ctx})
|
||||
}).catch(err => {
|
||||
wx.showToast({
|
||||
title: "分享图加载失败",
|
||||
icon: "none",
|
||||
duration: 3000
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
6
page_package/activity/activity.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"navigationBarTitleText": "活动详情",
|
||||
"navigationBarTextStyle": "black",
|
||||
"navigationBarBackgroundColor": "#eeeeee",
|
||||
"usingComponents": {}
|
||||
}
|
28
page_package/activity/activity.wxml
Normal file
@ -0,0 +1,28 @@
|
||||
<!--page_package/activity/activity.wxml-->
|
||||
<view wx:if="{{activityContent}}" style="background-color: #f2f2f2">
|
||||
<view class="cu-card bg-gradual-white">
|
||||
<view class="cu-item shadow-blur padding">
|
||||
<view class="flex-row flex-center color-black font30 margin-bottom font-w600">如何参与活动?</view>
|
||||
<text class="color6">{{copywriting}}</text>
|
||||
</view>
|
||||
<view class="cu-item shadow-blur padding">
|
||||
<view class="flex-row flex-center color-black font30 margin-bottom font-w600">活动文案</view>
|
||||
<text class="color6">{{activityContent.content}}</text>
|
||||
</view>
|
||||
|
||||
<view class="cu-item shadow-blur">
|
||||
<image src="{{activityContent.shareImage}}"
|
||||
bindtap="goToIcon"
|
||||
style="width: 100%;height: {{windowWidth}}px"/>
|
||||
<!-- <canvas canvas-id="myCanvas"-->
|
||||
<!-- class="bg-white"-->
|
||||
<!-- style="width: {{imgWidth}}px;height: {{imgHeight}}px;"></canvas>-->
|
||||
</view>
|
||||
</view>
|
||||
<view class='cu-tabbar-height'></view>
|
||||
<view class="cu-bar bg-white tabbar border shop bottom-bar">
|
||||
<view class="bg-orange submit" bindtap="onCopy" data-index="1">复制文字</view>
|
||||
<view class="bg-red submit" bindtap="goToIcon">分享图片</view>
|
||||
</view>
|
||||
|
||||
</view>
|
11
page_package/activity/activity.wxss
Normal file
@ -0,0 +1,11 @@
|
||||
/* page_package/activity/activity.wxss */
|
||||
page{
|
||||
background-color: #eeeeee;
|
||||
}
|
||||
|
||||
.bottom-bar{
|
||||
position: fixed;
|
||||
bottom: 0px;
|
||||
display: flex;
|
||||
width: 100%;
|
||||
}
|
210
page_package/apply-vip/apply-vip.js
Normal file
@ -0,0 +1,210 @@
|
||||
// page_package/apply-vip/apply-vip.js
|
||||
const app = getApp()
|
||||
const {superMembers, superMembersUp} = require('../../utils/network/services/user.js')
|
||||
const {uploadFile} = require('../../utils/network/services/service.js')
|
||||
const constants = require('../../utils/constants')
|
||||
const util = require('../../utils/util')
|
||||
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
members: null,
|
||||
imgList: [],
|
||||
invitationDialog:false
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
superMembers().then(res => {
|
||||
this.setData({members: res.data.data})
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage: function () {
|
||||
|
||||
},
|
||||
DelImg(e) {
|
||||
this.data.imgList.splice(e.currentTarget.dataset.index, 1);
|
||||
this.setData({
|
||||
imgList: this.data.imgList
|
||||
})
|
||||
},
|
||||
ChooseImage() {
|
||||
wx.chooseImage({
|
||||
count: 2, //默认9
|
||||
sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
|
||||
sourceType: ['album'], //从相册选择
|
||||
success: (res) => {
|
||||
if (this.data.imgList.length != 0) {
|
||||
this.setData({
|
||||
imgList: this.data.imgList.concat(res.tempFilePaths)
|
||||
})
|
||||
} else {
|
||||
this.setData({
|
||||
imgList: res.tempFilePaths
|
||||
})
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
onCopy(event) {
|
||||
console.log(event)
|
||||
wx.setClipboardData({
|
||||
data: event.currentTarget.dataset.code,
|
||||
success: function (res) {
|
||||
wx.getClipboardData({
|
||||
success: function (res) {
|
||||
wx.showToast({
|
||||
title: '复制成功'
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
onExample() {
|
||||
wx.navigateTo({
|
||||
url: '/page_package/apply-vip/example/example?example=' + JSON.stringify(this.data.members.examples)
|
||||
})
|
||||
},
|
||||
previewImg(event) {
|
||||
const index = event.currentTarget.dataset.index
|
||||
wx.previewImage({
|
||||
current: this.data.imgList[index],
|
||||
urls: this.data.imgList,
|
||||
})
|
||||
},
|
||||
onSubmit() {
|
||||
let that = this
|
||||
if (this.data.imgList.length != 2) {
|
||||
wx.showModal({
|
||||
title: '提示',
|
||||
showCancel: false,
|
||||
content: '最少需要提交两张图片',
|
||||
success(res) {
|
||||
}
|
||||
})
|
||||
return
|
||||
}
|
||||
Promise.all([
|
||||
new Promise((resolve, reject) => {
|
||||
uploadFile({
|
||||
path: that.data.imgList[0],
|
||||
type: 1
|
||||
}).then(res1 => {
|
||||
resolve(res1)
|
||||
}).catch(err1 => {
|
||||
reject(err1)
|
||||
})
|
||||
}),
|
||||
new Promise((resolve, reject) => {
|
||||
uploadFile({
|
||||
path: that.data.imgList[1],
|
||||
type: 1
|
||||
}).then(res1 => {
|
||||
resolve(res1)
|
||||
}).catch(err1 => {
|
||||
reject(err1)
|
||||
})
|
||||
})
|
||||
|
||||
// that.data.imgList.forEach(item => {
|
||||
//
|
||||
// })
|
||||
]).then(res2 => {
|
||||
let imgArr = []
|
||||
for (let i = 0; i < that.data.imgList.length; i++) imgArr.push(res2[i])
|
||||
superMembersUp({imageUrls: imgArr})
|
||||
.then((res) => {
|
||||
this.setData({invitationDialog:true})
|
||||
}).catch(err => {
|
||||
wx.showModal({
|
||||
title: '提示',
|
||||
showCancel: false,
|
||||
content: err.data.message ? err.data.message : '提交失败',
|
||||
success(res) {
|
||||
}
|
||||
})
|
||||
})
|
||||
}).catch(err2 => {
|
||||
wx.showModal({
|
||||
title: '提示',
|
||||
showCancel: false,
|
||||
content: err2.data.message ? err2.data.message : '提交失败',
|
||||
success(res) {
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
hideModal(event){
|
||||
this.setData({invitationDialog:false})
|
||||
if( event.currentTarget.dataset.iscode == 'x'){
|
||||
wx.requestSubscribeMessage({
|
||||
tmplIds: ['Ag7cMQ1Sl4dx8jdh_VavgZ1XWXoOPhVO5f66M6sJxq0'],
|
||||
success (res) {
|
||||
wx.showModal({
|
||||
title: '提示',
|
||||
showCancel: false,
|
||||
content: '订阅成功,审核结果第一时间发送给你',
|
||||
success(res) {
|
||||
wx.navigateBack({//返回
|
||||
delta: 2
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
})
|
6
page_package/apply-vip/apply-vip.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"navigationBarBackgroundColor": "#ffffff",
|
||||
"navigationBarTextStyle": "black",
|
||||
"navigationBarTitleText": "建群升级",
|
||||
"usingComponents": {}
|
||||
}
|
81
page_package/apply-vip/apply-vip.wxml
Normal file
@ -0,0 +1,81 @@
|
||||
<!--page_package/apply-vip/apply-vip.wxml-->
|
||||
<!--<custom bgColor="bg-gradual-main" isBack="{{true}}">-->
|
||||
<!-- <view slot="backText">返回</view>-->
|
||||
<!-- <view slot="content" class="font-w600">建群升级</view>-->
|
||||
<!--</custom>-->
|
||||
|
||||
|
||||
<view class="flex-column apply-body">
|
||||
<view class="apply-title margin-top-xl">升级进展:{{members.statusDesc}}</view>
|
||||
|
||||
<view class="margin-top-xl color3">为您分配微信群编号:{{members.groupId}}</view>
|
||||
|
||||
<view class="margin-top-sm color3">您需要做如下操作完成升级</view>
|
||||
|
||||
<text class="margin-top-sm color3 flex-row"
|
||||
bindtap="onCopy" data-code="{{members.groupName}}"
|
||||
style="line-height: 44rpx">1.新拉或已有一个超过{{members.memberCount}}人的微信推广群,群名称修改为“{{members.groupName}}”
|
||||
<text class="text-blue">复制群名称</text>
|
||||
</text>
|
||||
|
||||
<text wx:if="{{members.wechatId}}"
|
||||
bindtap="onCopy" data-code="{{members.wechatId}}"
|
||||
class="color3 flex-row" style="line-height: 44rpx">也可添加导师微信咨询,导师微信号:{{members.wechatId}}
|
||||
<text class="text-blue">复制微信号</text>
|
||||
</text>
|
||||
|
||||
<text class="margin-top-sm color3" style="line-height: 44rpx"
|
||||
bindtap="onExample">2.上传两张截图(截图一:显示出群主和群人数 截图二:显示出群名称)
|
||||
<text class="text-blue">查看示例</text>
|
||||
</text>
|
||||
|
||||
<text class="margin-top-sm color3" style="line-height: 44rpx">3.上传提交后,工作时间30分钟内会有审核结果,审核通过会有短信通知或订阅消息。</text>
|
||||
</view>
|
||||
|
||||
<view class="cu-bar bg-white margin-top">
|
||||
<view class="action">
|
||||
图片上传
|
||||
</view>
|
||||
<view class="action">
|
||||
{{imgList.length}}/2
|
||||
</view>
|
||||
</view>
|
||||
<view class="cu-form-group">
|
||||
<view class="grid col-4 grid-square flex-sub">
|
||||
<view class="bg-img" wx:for="{{imgList}}" wx:key="*this" bindtap="ViewImage" data-url="{{imgList[index]}}">
|
||||
<image src='{{imgList[index]}}' mode='aspectFill' bindtap="previewImg" data-index></image>
|
||||
<view class="cu-tag bg-red" catchtap="DelImg" data-index="{{index}}">
|
||||
<text class="cuIcon-close"></text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="solids" bindtap="ChooseImage" wx:if="{{imgList.length<2}}">
|
||||
<text class="cuIcon-cameraadd"></text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="cu-btn bg-green font31 margin-top"
|
||||
bindtap="onSubmit"
|
||||
style="height: 84rpx;width: 80%;margin-left: 10%;border-radius: 12rpx;">提交审核
|
||||
</view>
|
||||
|
||||
|
||||
<view class="cu-modal {{invitationDialog ? 'show':''}}">
|
||||
<view class="cu-dialog">
|
||||
<view class="cu-bar bg-white justify-end">
|
||||
<view class="content">提示</view>
|
||||
<view class="action" bindtap="hideModal">
|
||||
<text class="cuIcon-close text-red"></text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="padding-xl bg-gradual-white1 flex-column flex-center font30">
|
||||
<text class="line-height">提交成功啦!,请等待1~3个工作日</text>
|
||||
<text class="line-height">你可以订阅消息,第一时间获取审核进度</text>
|
||||
</view>
|
||||
<view class="cu-bar bg-white ">
|
||||
<view class="action margin-0 flex-sub solid-left" bindtap="hideModal" data-iscode="1">取消</view>
|
||||
<view class="action margin-0 flex-sub solid-left color-main" bindtap="hideModal" data-iscode="x">订阅消息
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
16
page_package/apply-vip/apply-vip.wxss
Normal file
@ -0,0 +1,16 @@
|
||||
/* page_package/apply-vip/apply-vip.wxss */
|
||||
page {
|
||||
background-color: #f2f2f2;
|
||||
}
|
||||
|
||||
.apply-body {
|
||||
width: 94%;
|
||||
margin-left: 3%;
|
||||
}
|
||||
|
||||
.apply-title {
|
||||
margin-top: 48 rpx;
|
||||
font-size: 32 rpx;
|
||||
font-weight: 600;
|
||||
color: #000;
|
||||
}
|
67
page_package/apply-vip/example/example.js
Normal file
@ -0,0 +1,67 @@
|
||||
// page_package/apply-vip/example/example.js
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
example:[]
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
let example = JSON.parse(options.example)
|
||||
this.setData({example:example})
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage: function () {
|
||||
|
||||
}
|
||||
})
|
6
page_package/apply-vip/example/example.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"navigationBarBackgroundColor": "#ffffff",
|
||||
"navigationBarTextStyle": "black",
|
||||
"navigationBarTitleText": "截图示例",
|
||||
"usingComponents": {}
|
||||
}
|
5
page_package/apply-vip/example/example.wxml
Normal file
@ -0,0 +1,5 @@
|
||||
<!--page_package/apply-vip/example/example.wxml-->
|
||||
<view wx:for="{{example}}" wx:key="*this">
|
||||
<view class="font31 color3 font-w600 margin">{{item.step}}</view>
|
||||
<image src="{{item.imageUrl}}" mode="widthFix" style="width: 90%;margin-left: 5%;"></image>
|
||||
</view>
|
1
page_package/apply-vip/example/example.wxss
Normal file
@ -0,0 +1 @@
|
||||
/* page_package/apply-vip/example/example.wxss */
|
144
page_package/contacts/contacts.js
Normal file
@ -0,0 +1,144 @@
|
||||
const app = getApp()
|
||||
const {userContacts, updateUserInfo} = require('../../utils/network/services/user.js')
|
||||
const constants = require('../../utils/constants')
|
||||
const util = require('../../utils/util')
|
||||
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
isEditWeChat: false,
|
||||
weChatCode: '',
|
||||
windowWidth: app.globalData.windowWidth,
|
||||
windowHeight: app.globalData.windowHeight,
|
||||
queryData: {
|
||||
pageIndex: 1,
|
||||
pageSize: 20
|
||||
},
|
||||
requesting: false,
|
||||
infoData: null
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
this.refresh()
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh: function () {
|
||||
wx.vibrateShort();
|
||||
this.refresh()
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage: function () {
|
||||
|
||||
},
|
||||
onEdit() {
|
||||
this.setData({isEditWeChat: true})
|
||||
},
|
||||
onSave() {
|
||||
this.setData({isEditWeChat: false})
|
||||
updateUserInfo({wechatId: this.data.weChatCode})
|
||||
.then(res => {
|
||||
|
||||
})
|
||||
},
|
||||
onCopy(event) {
|
||||
if (event.currentTarget.dataset.code) {
|
||||
wx.setClipboardData({
|
||||
data: event.currentTarget.dataset.code,
|
||||
success: function (res) {
|
||||
wx.getClipboardData({
|
||||
success: function (res) {
|
||||
wx.showToast({
|
||||
title: '复制成功'
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
} else wx.showToast({
|
||||
title: '暂无微信号'
|
||||
})
|
||||
},
|
||||
bindInput(event) {
|
||||
this.setData({weChatCode: event.detail.value})
|
||||
},
|
||||
getData(type) {
|
||||
userContacts(this.data.queryData)
|
||||
.then(res => {
|
||||
wx.stopPullDownRefresh()
|
||||
let arr = this.data.infoData
|
||||
if (arr && type == 'more') {
|
||||
res.data.data.fans.forEach(item => {
|
||||
arr.fans.push(item)
|
||||
})
|
||||
}
|
||||
this.setData({
|
||||
infoData: arr ? arr : res.data.data,
|
||||
requesting: false,
|
||||
weChatCode: res.data.data.mine.wechatId ? res.data.data.mine.wechatId : ''
|
||||
})
|
||||
}).catch(err => {
|
||||
wx.stopPullDownRefresh()
|
||||
this.setData({requesting: false})
|
||||
})
|
||||
},
|
||||
refresh() {
|
||||
this.data.queryData.pageIndex = 1
|
||||
this.setData({queryData: this.data.queryData, requesting: true})
|
||||
this.getData('refresh')
|
||||
},
|
||||
more() {
|
||||
this.data.queryData.pageIndex = ++this.data.queryData.pageIndex
|
||||
this.setData({queryData: this.data.queryData})
|
||||
this.getData('more')
|
||||
},
|
||||
onReachBottom(){
|
||||
this.more()
|
||||
}
|
||||
})
|
7
page_package/contacts/contacts.json
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"navigationBarBackgroundColor": "#ffffff",
|
||||
"navigationBarTextStyle": "black",
|
||||
"navigationBarTitleText": "我的团队",
|
||||
"enablePullDownRefresh": true,
|
||||
"usingComponents": {}
|
||||
}
|
91
page_package/contacts/contacts.wxml
Normal file
@ -0,0 +1,91 @@
|
||||
<!--page_package/contacts/contacts.wxml-->
|
||||
<!--<scroll-view scroll-y-->
|
||||
<!-- bindscrolltolower="more"-->
|
||||
<!-- lower-threshold="128"-->
|
||||
<!-- refresher-enabled="true"-->
|
||||
<!-- bindrefresherrefresh="refresh"-->
|
||||
<!-- refresher-triggered="{{requesting}}">-->
|
||||
<view class="bg-white padding-sm">
|
||||
<view class="color-black font30 margin-left-sm font-w600">我的<text class="color6 margin-left-sm font24" style="font-weight: 200" wx:if="{{!weChatCode}}">赶快填写微信号吧~方便导师添加你进行指导</text>
|
||||
</view>
|
||||
<view class="flex-row font-center margin-top-xs" style="border-top: 1px solid #f2f2f2">
|
||||
<image class="round cu-avatar lg margin-left-sm margin-top-xs" src="{{infoData.mine.avatarUrl}}"/>
|
||||
<view class="flex-column margin-left-sm">
|
||||
<view class="flex-row font-center">
|
||||
<view class="font28 color3">{{infoData.mine.nickName}}</view>
|
||||
<view class="rank margin-left-xs font20">{{infoData.mine.identifyDesc}}</view>
|
||||
</view>
|
||||
<input placeholder="请输入你的微信号"
|
||||
class="margin-top-xs"
|
||||
focus="isEditWeChat"
|
||||
bindinput="bindInput"
|
||||
value="{{weChatCode}}"
|
||||
wx:if="{{isEditWeChat}}"/>
|
||||
<view wx:else
|
||||
bindtap="onEdit"
|
||||
class="margin-top-xs color6 font24">{{weChatCode?weChatCode:'点此填写微信号'}}<text class="cuIcon-edit margin-left-xs" style="color: #333333;font-size: 30rpx"/></view>
|
||||
</view>
|
||||
<view class="absolute-right action-btn1 color-main font24"
|
||||
bindtap="onSave"
|
||||
wx:if="{{isEditWeChat}}">保 存</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="bg-white padding-sm margin-top-sm">
|
||||
<view class="color-black font30 margin-left-sm font-w600">邀请人</view>
|
||||
<view class="flex-row font-center margin-top-xs" style="border-top: 1px solid #f2f2f2">
|
||||
<image class="round cu-avatar lg margin-left-sm margin-top-xs" src="{{infoData.inviter.avatarUrl}}"/>
|
||||
<view class="flex-column margin-left-sm">
|
||||
<view class="flex-row font-center">
|
||||
<view class="font28 color3">{{infoData.inviter.nickName}}</view>
|
||||
<view class="margin-left-xs font20 cuIcon-crownfill {{infoData.inviter.identify > 1 ? 'color-main':'color8'}}"/>
|
||||
</view>
|
||||
<view class="margin-top-xs color6 font24">微信号:{{infoData.inviter.wechatId}}</view>
|
||||
</view>
|
||||
<view class="absolute-right action-btn1 color-main font24"
|
||||
data-code="{{infoData.inviter.wechatId}}"
|
||||
bindtap="onCopy">复制微信</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="bg-white padding-sm margin-top-sm">
|
||||
<view class="color-black font30 margin-left-sm font-w600">导师</view>
|
||||
<view class="flex-row font-center margin-top-xs" style="border-top: 1px solid #f2f2f2">
|
||||
<image class="round cu-avatar lg margin-left-sm margin-top-xs" src="{{infoData.teacher.avatarUrl}}"/>
|
||||
<view class="flex-column margin-left-sm">
|
||||
<view class="flex-row font-center">
|
||||
<view class="font28 color3">{{infoData.teacher.nickName}}</view>
|
||||
<view class="margin-left-xs font20 cuIcon-crownfill {{infoData.teacher.identify > 1 ? 'color-main':'color8'}}"/>
|
||||
</view>
|
||||
<view class="margin-top-xs color6 font24">微信号:{{infoData.teacher.wechatId}}</view>
|
||||
</view>
|
||||
<view class="absolute-right action-btn1 color-main font24"
|
||||
data-code="{{infoData.teacher.wechatId}}"
|
||||
bindtap="onCopy">复制微信</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="bg-white padding-sm margin-top-sm">
|
||||
<!-- -->
|
||||
<view class="color-black font30 margin-left-sm font-w600">我的粉丝<text class="color6 margin-left-sm font24" style="font-weight: 200">仅显示已填写微信号的粉丝</text></view>
|
||||
<view class="flex-row font-center margin-top-xs" style="border-top: 1px solid #f2f2f2"
|
||||
wx:for="{{infoData.fans}}" wx:key="*this">
|
||||
<image class="round cu-avatar lg margin-left-sm margin-top-xs"
|
||||
src="{{item.avatarUrl}}"/>
|
||||
<view class="flex-column margin-left-sm">
|
||||
<view class="flex-row font-center">
|
||||
<view class="font28 color3">{{item.nickName}}</view>
|
||||
<view class="margin-left-xs font20 cuIcon-crownfill {{item.identify > 1 ? 'color-main':'color8'}}"/>
|
||||
</view>
|
||||
<view class="margin-top-xs color6 font24">微信号:{{item.wechatId}}</view>
|
||||
</view>
|
||||
<view class="absolute-right action-btn1 color-main font24"
|
||||
data-code="{{item.wechatId}}"
|
||||
wx:if="{{item.wechatId}}"
|
||||
bindtap="onCopy">复制微信</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex-row flex-center" style="width: {{windowWidth}}px;">
|
||||
<view class="color8 font22 margin-top margin-bottom">———— 已经到底啦 ————</view>
|
||||
</view>
|
||||
|
||||
<!--</scroll-view>-->
|
25
page_package/contacts/contacts.wxss
Normal file
@ -0,0 +1,25 @@
|
||||
/* page_package/contacts/contacts.wxss */
|
||||
|
||||
page{
|
||||
background-color: #f2f2f2;
|
||||
}
|
||||
|
||||
.absolute-right{
|
||||
position: absolute;
|
||||
right: 40rpx;
|
||||
}
|
||||
|
||||
.action-btn1{
|
||||
padding: 4rpx 16rpx;
|
||||
border-radius: 6rpx;
|
||||
background-color: white;
|
||||
border: 1rpx solid #f43f3b;
|
||||
}
|
||||
|
||||
.rank{
|
||||
padding: 4rpx 16rpx;
|
||||
border-radius: 32rpx;
|
||||
color:#888;
|
||||
background-color: white;
|
||||
border: 1rpx solid #666666;
|
||||
}
|
588
page_package/details/index.js
Normal file
@ -0,0 +1,588 @@
|
||||
// page_package/details/index.js
|
||||
const app = getApp()
|
||||
const {goodsUrl, productsCode, appCode, purchaseUrl} = require("../../utils/network/services/productImpl.js")
|
||||
const constants = require("../../utils/constants")
|
||||
const util = require("../../utils/util")
|
||||
const {onLogin} = require("../../utils/network/services/user.js")
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
StatusBar: app.globalData.StatusBar,
|
||||
CustomBar: app.globalData.CustomBar,
|
||||
Custom: app.globalData.Custom,
|
||||
windowWidth: app.globalData.windowWidth,
|
||||
windowHeight: app.globalData.windowHeight,
|
||||
userInfo: app.globalData.userInfo,
|
||||
productDetails: null,
|
||||
invitationDialog: false,
|
||||
imgWidth: 0,
|
||||
imgHeight: 0,
|
||||
ctx: null,
|
||||
modalName: "",
|
||||
shareURl: "",
|
||||
shareImgPath: "",
|
||||
synthesisImg: '',
|
||||
appImg: '',
|
||||
userInfo: app.globalData.userInfo,
|
||||
shareType: 1
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
this.setData({
|
||||
productDetails: util.getStorage(constants.PRPDUCT_ITEM),
|
||||
imgWidth: 255,//app.globalData.windowWidth * 0.68
|
||||
imgHeight: 407, //app.globalData.windowHeight * 0.61
|
||||
})
|
||||
let coupons = this.data.productDetails.coupons
|
||||
let data = {
|
||||
invitationCode: '',
|
||||
couponUrl: coupons.length > 0 ? coupons[coupons.length - 1].link : '',
|
||||
materialId: this.data.productDetails.materialUrl
|
||||
}
|
||||
if (!app.globalData.loginStatus) {
|
||||
let that = this
|
||||
wx.login({
|
||||
success: res => {
|
||||
onLogin(res.code)
|
||||
.then(res => {
|
||||
app.globalData.userInfo = res.data.data
|
||||
util.setStorage(constants.AUTH_INFO, res.data.data)
|
||||
that.setData({userInfo: res.data.data})
|
||||
purchaseUrl(data).then(res => {
|
||||
that.setData({shareURl: res.data.data.shortURL})
|
||||
})
|
||||
}).catch((err) => {
|
||||
if (err.data.code = 'USER_NOT_REGISTERED') {
|
||||
// that.setData({token: err.data.data.token})
|
||||
wx.navigateTo({url: '/pages/login/login?token=' + err.data.data.token})
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
} else {
|
||||
purchaseUrl(data).then(res => {
|
||||
this.setData({shareURl: res.data.data.shortURL})
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角
|
||||
*/
|
||||
onShareAppMessage: function (res) {
|
||||
this.setData({modalName: ''})
|
||||
return {
|
||||
title: this.data.productDetails.skuName,
|
||||
path: '/pages/product/product?id=' + this.data.productDetails.skuId + '&invitationCode=' + this.data.userInfo.invitationCode,
|
||||
imageUrl: this.data.productDetails.images[0],
|
||||
success: function (res) {
|
||||
// 转发成功
|
||||
console.log('转发成功')
|
||||
},
|
||||
fail: function (res) {
|
||||
// 转发失败
|
||||
console.log('转发失败')
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
goHome(event) {
|
||||
wx.reLaunch({
|
||||
url: '/pages/index/index',
|
||||
})
|
||||
},
|
||||
onShowModel() {
|
||||
this.setData({
|
||||
modalName: 'bottomModal'
|
||||
})
|
||||
},
|
||||
onShare(event) {
|
||||
let that = this
|
||||
let index = event.currentTarget.dataset.index
|
||||
that.imgLoader(index)
|
||||
that.setData({
|
||||
modalName: '',
|
||||
shareType: Number(index)
|
||||
})
|
||||
},
|
||||
onClose() {
|
||||
let that = this
|
||||
this.setData({
|
||||
invitationDialog: false,
|
||||
})
|
||||
this.data.ctx.draw()
|
||||
|
||||
if (this.data.shareImgPath) {
|
||||
wx.getFileSystemManager().unlink({
|
||||
filePath: this.data.shareImgPath,
|
||||
success: res => {
|
||||
that.setData({shareImgPath: ''})
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
imgLoader(index) {
|
||||
if ((this.data.synthesisImg && index == 1) || (this.data.appImg && index == 0)) {
|
||||
this.setData({invitationDialog: true})
|
||||
} else {
|
||||
let that = this
|
||||
wx.showLoading({title: '合成中...',})
|
||||
Promise.all([
|
||||
new Promise((resolve, reject) => {
|
||||
wx.getImageInfo({
|
||||
src: that.data.productDetails.images[0],
|
||||
success(res) {
|
||||
resolve(res)
|
||||
},
|
||||
fail(err) {
|
||||
err.prompt = '合成商品图失败'
|
||||
reject(err)
|
||||
}
|
||||
})
|
||||
}),
|
||||
new Promise((resolve, reject) => {
|
||||
wx.getImageInfo({
|
||||
src: that.data.userInfo.avatarUrl,
|
||||
success(res) {
|
||||
resolve(res)
|
||||
},
|
||||
fail(err) {
|
||||
err.prompt = '合成头像失败'
|
||||
reject(err)
|
||||
}
|
||||
})
|
||||
}),
|
||||
|
||||
new Promise((resolve, reject) => {
|
||||
if (index == 1) {//商品推廣
|
||||
let data = {
|
||||
materialUrl: this.data.productDetails.materialUrl,
|
||||
size: 72
|
||||
}
|
||||
if (this.data.productDetails.coupons.length > 0) {
|
||||
data = {
|
||||
couponUrl: this.data.productDetails.coupons[this.data.productDetails.coupons.length - 1].link,
|
||||
materialUrl: this.data.productDetails.materialUrl,
|
||||
size: 72
|
||||
}
|
||||
}
|
||||
productsCode(data)
|
||||
.then(res => {
|
||||
let filePath = `${wx.env.USER_DATA_PATH}/${that.data.productDetails.skuId}`;
|
||||
wx.getFileSystemManager().writeFile({
|
||||
filePath: filePath,
|
||||
data: wx.base64ToArrayBuffer(res.data.data.content),
|
||||
encoding: 'binary',
|
||||
success: () => {
|
||||
resolve(filePath);
|
||||
},
|
||||
fail: err => {
|
||||
err.prompt = '合成商品码失败'
|
||||
reject(err);
|
||||
},
|
||||
});
|
||||
}).catch((err) => {
|
||||
err.prompt = '获取商品码失败'
|
||||
reject(err);
|
||||
})
|
||||
} else {
|
||||
let data = {
|
||||
page: "pages/product/product",
|
||||
scene: {id: that.data.productDetails.skuId,},
|
||||
size: 72
|
||||
}
|
||||
appCode(data)
|
||||
.then(res => {
|
||||
let filePath = `${wx.env.USER_DATA_PATH}/${that.data.productDetails.skuId}${that.data.productDetails.inOrderCount30Days}`;
|
||||
wx.getFileSystemManager().writeFile({
|
||||
filePath: filePath,
|
||||
data: wx.base64ToArrayBuffer(res.data.data.content),
|
||||
encoding: 'binary',
|
||||
success: () => {
|
||||
resolve(filePath);
|
||||
},
|
||||
fail: err => {
|
||||
err.prompt = '合成推广码失败'
|
||||
reject(err);
|
||||
},
|
||||
});
|
||||
}).catch((err) => {
|
||||
err.prompt = '获取推广码失败'
|
||||
reject(err);
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
]).then(res => {
|
||||
let id = index == 1 ? 'myCanvas' : 'myCanvas1'
|
||||
const ctx = wx.createCanvasContext(id, that);
|
||||
ctx.fillStyle = "#FFFFFF";
|
||||
ctx.fillRect(0, 0, that.data.imgWidth, that.data.imgHeight);
|
||||
that.setData({ctx: ctx})
|
||||
const productImg = res[0].path //商品图
|
||||
const title = that.data.productDetails.skuName //商品名称
|
||||
const titleLines = that.skuNameFormat(ctx, title)
|
||||
//券后价
|
||||
const couponPrice = that.data.productDetails.priceInfo.lowestCouponPrice ? that.data.productDetails.priceInfo.lowestCouponPrice : that.data.productDetails.priceInfo.price
|
||||
const comment = util.formatNUmber(that.data.productDetails.comments) //评论条数
|
||||
const praise = that.data.productDetails.goodCommentsShare //好评率
|
||||
const price = util.formatNUmber(that.data.productDetails.priceInfo.price) //京东价
|
||||
//优惠券
|
||||
let coupon = 0
|
||||
if (that.data.productDetails.coupons.length > 0)
|
||||
coupon = that.data.productDetails.coupons[0].discount ? that.data.productDetails.coupons[0].discount : 0
|
||||
|
||||
const avatarUrl = res[1].path //用户头像
|
||||
const userName = that.data.userInfo.nickName //用户昵称
|
||||
const code = "DHWKLD"
|
||||
const promotionCode = res[2].path //推广码
|
||||
|
||||
//绘制商品图
|
||||
ctx.drawImage(productImg, 0, 0, that.data.imgWidth, that.data.imgWidth);
|
||||
ctx.save();
|
||||
|
||||
//京东标识矩形
|
||||
ctx.rect(10, that.data.imgWidth + 10, 23, 11)
|
||||
ctx.setFillStyle('#f43f3b')
|
||||
ctx.setStrokeStyle('#f43f3b')
|
||||
// ctx.setBorderRadius(5)
|
||||
ctx.fill()
|
||||
|
||||
//京东标识文字
|
||||
ctx.setTextAlign('left')
|
||||
ctx.setFillStyle('#ffffff')
|
||||
ctx.setFontSize(9)
|
||||
ctx.fillText('京东', 12, that.data.imgWidth + 18)
|
||||
ctx.stroke()
|
||||
|
||||
//商品标题第一行
|
||||
ctx.setTextAlign('left')
|
||||
ctx.setFillStyle('#333333')
|
||||
ctx.setFontSize(11)
|
||||
ctx.fillText(titleLines[0], 43, that.data.imgWidth + 20)
|
||||
ctx.stroke()
|
||||
|
||||
//商品标题第二行
|
||||
ctx.setTextAlign('left')
|
||||
ctx.setFillStyle('#333333')
|
||||
ctx.setFontSize(11)
|
||||
ctx.fillText(titleLines.length > 1 ? titleLines[1] : ' ', 10, that.data.imgWidth + 40)
|
||||
ctx.stroke()
|
||||
|
||||
//券后价文本
|
||||
ctx.setTextAlign('left')
|
||||
ctx.setFillStyle('#f43f3b')
|
||||
ctx.setFontSize(9)
|
||||
ctx.fillText("券后价¥", 10, that.data.imgWidth + 64)
|
||||
ctx.stroke()
|
||||
|
||||
//券后价
|
||||
ctx.setTextAlign('left')
|
||||
ctx.setFillStyle('#f43f3b')
|
||||
ctx.setFontSize(15)
|
||||
ctx.fillText(util.isNumber(couponPrice) ? Number(couponPrice).toFixed(2) : couponPrice, 45, that.data.imgWidth + 64)
|
||||
ctx.stroke()
|
||||
|
||||
//评论 好评
|
||||
ctx.setTextAlign('right')
|
||||
ctx.setFillStyle('#666666')
|
||||
ctx.setFontSize(9)
|
||||
ctx.fillText(comment + "条评论 好评率" + praise + "%", that.data.imgWidth - 10, that.data.imgWidth + 64)
|
||||
ctx.stroke()
|
||||
|
||||
//京东价
|
||||
ctx.setTextAlign('left')
|
||||
ctx.setFillStyle('#666666')
|
||||
ctx.setFontSize(9)
|
||||
ctx.fillText(util.isNumber(price) ? "京东价¥" + Number(price).toFixed(2) : "京东价¥" + price, 10, that.data.imgWidth + 86)
|
||||
ctx.stroke()
|
||||
|
||||
//优惠券
|
||||
ctx.setTextAlign('left')
|
||||
ctx.setFillStyle('#f43f3b')
|
||||
ctx.setFontSize(12)
|
||||
ctx.fillText("优惠券¥" + coupon, 90, that.data.imgWidth + 86)
|
||||
ctx.stroke()
|
||||
|
||||
//用户昵称
|
||||
ctx.setTextAlign('left')
|
||||
ctx.setFillStyle('#333333')
|
||||
ctx.setFontSize(11)
|
||||
ctx.fillText('好友' + userName, 64, that.data.imgWidth + 116)
|
||||
ctx.stroke()
|
||||
|
||||
//用户昵称
|
||||
ctx.setTextAlign('left')
|
||||
ctx.setFillStyle('#666666')
|
||||
ctx.setFontSize(8)
|
||||
ctx.fillText('推荐您享受京东购物优惠', 64, that.data.imgWidth + 134)
|
||||
ctx.stroke()
|
||||
|
||||
//
|
||||
ctx.setTextAlign('right')
|
||||
ctx.setFillStyle('#444444')
|
||||
ctx.setFontSize(9)
|
||||
ctx.fillText('长按识别', that.data.imgWidth - 28, that.data.imgHeight - 5)
|
||||
ctx.stroke()
|
||||
|
||||
//用户头像
|
||||
ctx.arc(34, that.data.imgWidth + 120, 24, 0, Math.PI * 2, false);
|
||||
ctx.clip();
|
||||
ctx.drawImage(avatarUrl, 10, that.data.imgWidth + 96, 48, 48);
|
||||
ctx.restore();
|
||||
|
||||
//推广二维码
|
||||
ctx.drawImage(res[2], that.data.imgWidth - 74, that.data.imgHeight - 79, 64, 64);
|
||||
ctx.restore();
|
||||
|
||||
ctx.draw()
|
||||
|
||||
setTimeout(() => {
|
||||
that.heIMg(that, index, id)
|
||||
that.setData({
|
||||
shareImgPath: res[2]
|
||||
})
|
||||
}, 150)
|
||||
}).catch(err => {
|
||||
console.log(JSON.stringify(err))
|
||||
wx.hideLoading()
|
||||
wx.showModal({
|
||||
title: '提示',
|
||||
showCancel: false,
|
||||
content: err.prompt?err.prompt:"合成图片失败",
|
||||
success(res) {
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
heIMg(that, index, id) {
|
||||
wx.canvasToTempFilePath({
|
||||
x: 0,
|
||||
y: 0,
|
||||
width: that.data.imgWidth,
|
||||
height: that.data.imgHeight,
|
||||
canvasId: id,
|
||||
success: function (res) {
|
||||
wx.hideLoading()
|
||||
console.log("图片ID=", id)
|
||||
if (index == 1)
|
||||
that.setData({
|
||||
synthesisImg: res.tempFilePath,
|
||||
invitationDialog: true
|
||||
})
|
||||
else that.setData({
|
||||
appImg: res.tempFilePath,
|
||||
invitationDialog: true
|
||||
})
|
||||
},
|
||||
fail: function (err) {
|
||||
wx.hideLoading()
|
||||
}
|
||||
}, that)
|
||||
},
|
||||
|
||||
skuNameFormat(context, title) {
|
||||
let ostrtxt = ''
|
||||
let olinenum = 0
|
||||
let oarrtxt = []
|
||||
context.setFontSize(11)
|
||||
for (let i = 0; i < title.length; i++) {
|
||||
ostrtxt = ostrtxt + title[i]
|
||||
let ometricsw = context.measureText(ostrtxt) //计算字符宽度
|
||||
if (oarrtxt.length == 0) {
|
||||
if (ometricsw.width > this.data.imgWidth - 60) {//设置每行的宽度
|
||||
olinenum++
|
||||
oarrtxt = oarrtxt.concat([ostrtxt])
|
||||
ostrtxt = '';
|
||||
}
|
||||
} else {
|
||||
if (ometricsw.width > this.data.imgWidth - 25) {//设置每行的宽度
|
||||
olinenum++
|
||||
oarrtxt = oarrtxt.concat([ostrtxt])
|
||||
ostrtxt = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
oarrtxt = oarrtxt.concat([ostrtxt])
|
||||
return oarrtxt
|
||||
},
|
||||
imgPreview(event) {
|
||||
const index = event.currentTarget.dataset.index
|
||||
wx.previewImage({
|
||||
current: this.data.productDetails.images[index],
|
||||
urls: this.data.productDetails.images
|
||||
})
|
||||
},
|
||||
previewImg(event) {
|
||||
wx.previewImage({
|
||||
urls: [this.data.shareType == 1 ? this.data.synthesisImg : this.data.appImg],
|
||||
})
|
||||
},
|
||||
saveImg: function (event) {
|
||||
wx.showLoading({title: '保存中...',})
|
||||
wx.saveImageToPhotosAlbum({
|
||||
filePath: this.data.shareType == 1 ? this.data.synthesisImg : this.data.appImg,//canvasToTempFilePath返回的tempFilePath
|
||||
success: (res) => {
|
||||
wx.hideLoading()
|
||||
wx.showModal({
|
||||
title: '提示',
|
||||
showCancel: false,
|
||||
content: '图片保存成功,进入系统相册分享吧~',
|
||||
success(res) {
|
||||
if (res.confirm) {
|
||||
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
fail: (err) => {
|
||||
wx.hideLoading()
|
||||
wx.showModal({
|
||||
title: '提示',
|
||||
showCancel: false,
|
||||
content: '请到小程序设置中打开相册权限',
|
||||
success(res) {
|
||||
if (res.confirm) {
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
goToJD() {
|
||||
if (this.data.shareURl) {
|
||||
let materialUrl = encodeURIComponent(this.data.shareURl);
|
||||
//pages/item/detail/detail?sku=xxx
|
||||
wx.navigateToMiniProgram({
|
||||
appId: 'wx91d27dbf599dff74',
|
||||
path: 'pages/union/proxy/proxy?spreadUrl=' + materialUrl,
|
||||
envVersion: 'release',
|
||||
success(res) {
|
||||
// 打开成功
|
||||
}
|
||||
});
|
||||
} else {
|
||||
let coupons = this.data.productDetails.coupons
|
||||
let data = {
|
||||
chainType: 2,
|
||||
couponUrl: coupons[coupons.length - 1].link,
|
||||
materialId: this.data.productDetails.materialUrl
|
||||
}
|
||||
if (coupons.length > 0) {
|
||||
data = {
|
||||
chainType: 2,
|
||||
couponUrl: coupons[coupons.length - 1].link,
|
||||
materialId: this.data.productDetails.materialUrl
|
||||
}
|
||||
}
|
||||
goodsUrl(data).then(res => {
|
||||
this.setData({shareURl: res.data.data.shortURL})
|
||||
let materialUrl = encodeURIComponent(this.data.shareURl);
|
||||
wx.navigateToMiniProgram({
|
||||
appId: 'wx91d27dbf599dff74',
|
||||
path: 'pages/union/proxy/proxy?spreadUrl=' + materialUrl,
|
||||
envVersion: 'release',
|
||||
success(res) {
|
||||
// 打开成功
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
onCloseModel() {
|
||||
this.setData({
|
||||
modalName: ''
|
||||
})
|
||||
},
|
||||
copySkuID() {
|
||||
wx.setClipboardData({
|
||||
data: (this.data.productDetails.skuId).toString(),
|
||||
success: function (res) {
|
||||
wx.getClipboardData({
|
||||
success: function (res) {
|
||||
wx.showToast({
|
||||
title: '复制成功'
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
copySkuName() {
|
||||
wx.setClipboardData({
|
||||
data: this.data.productDetails.skuName,
|
||||
success: function (res) {
|
||||
wx.getClipboardData({
|
||||
success: function (res) {
|
||||
wx.showToast({
|
||||
title: '复制成功'
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
onDetails() {
|
||||
wx.navigateToMiniProgram({
|
||||
appId: 'wx91d27dbf599dff74',
|
||||
path: 'pages/item/detail/detail?sku=' + this.data.productDetails.skuId,
|
||||
envVersion: 'release',
|
||||
success(res) {
|
||||
// 打开成功
|
||||
}
|
||||
});
|
||||
},
|
||||
})
|