Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
N
nyx
概览
Overview
Details
Activity
Cycle Analytics
版本库
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
问题
0
Issues
0
列表
Board
标记
里程碑
合并请求
0
Merge Requests
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
Snippets
成员
Collapse sidebar
Close sidebar
活动
图像
聊天
创建新问题
作业
提交
Issue Boards
Open sidebar
发现
nyx
Commits
a7f26c3b
Commit
a7f26c3b
authored
Aug 13, 2020
by
jscat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nyx weapp, 主流程
1. 为活动创建添加代码
parent
7332bcd8
隐藏空白字符变更
内嵌
并排
正在显示
22 个修改的文件
包含
947 行增加
和
49 行删除
+947
-49
增值产品-小程序及app/nyx-master/app.js
+4
-1
增值产品-小程序及app/nyx-master/app.json
+6
-3
增值产品-小程序及app/nyx-master/component/calendar/index.wxss
+6
-5
增值产品-小程序及app/nyx-master/icon/add.png
+0
-0
增值产品-小程序及app/nyx-master/icon/del.png
+0
-0
增值产品-小程序及app/nyx-master/pages/activity/activity-info/activity-info.js
+12
-1
增值产品-小程序及app/nyx-master/pages/activity/activity-info/activity-info.wxml
+2
-2
增值产品-小程序及app/nyx-master/pages/activity/activity.js
+10
-5
增值产品-小程序及app/nyx-master/pages/member/activity-post/activity-edit/activity-edit.js
+93
-0
增值产品-小程序及app/nyx-master/pages/member/activity-post/activity-edit/activity-edit.json
+5
-0
增值产品-小程序及app/nyx-master/pages/member/activity-post/activity-edit/activity-edit.wxml
+94
-0
增值产品-小程序及app/nyx-master/pages/member/activity-post/activity-edit/activity-edit.wxss
+96
-0
增值产品-小程序及app/nyx-master/pages/member/activity-post/activity-post.js
+208
-0
增值产品-小程序及app/nyx-master/pages/member/activity-post/activity-post.json
+5
-0
增值产品-小程序及app/nyx-master/pages/member/activity-post/activity-post.wxml
+38
-0
增值产品-小程序及app/nyx-master/pages/member/activity-post/activity-post.wxss
+68
-0
增值产品-小程序及app/nyx-master/pages/member/activity-post/activity-submit/activity-submit.js
+215
-0
增值产品-小程序及app/nyx-master/pages/member/activity-post/activity-submit/activity-submit.json
+5
-0
增值产品-小程序及app/nyx-master/pages/member/activity-post/activity-submit/activity-submit.wxml
+22
-0
增值产品-小程序及app/nyx-master/pages/member/activity-post/activity-submit/activity-submit.wxss
+11
-0
增值产品-小程序及app/nyx-master/pages/member/schedule/schedule.js
+45
-30
增值产品-小程序及app/nyx-master/pages/my/my-members/my-members.wxml
+2
-2
没有找到文件。
增值产品-小程序及app/nyx-master/app.js
查看文件 @
a7f26c3b
//app
.js
//app
.js
...
@@ -49,6 +49,9 @@ App({
...
@@ -49,6 +49,9 @@ App({
},
},
//activity-submit跳转后需要带上category的index
switchId
:
""
,
},
},
onLaunch
:
function
()
{
onLaunch
:
function
()
{
...
...
增值产品-小程序及app/nyx-master/app.json
查看文件 @
a7f26c3b
{
{
{
{
"pages"
:
[
"pages"
:
[
"pages/member/activity-post/activity-submit/activity-submit"
,
"pages/member/activity-post/activity-edit/activity-edit"
,
"pages/activity/activity"
,
"pages/activity/activity"
,
"pages/mall/order/order"
,
"pages/mall/order/order"
,
"pages/member/schedule/schedule"
,
"pages/key/key"
,
"pages/member/schedule/schedule"
,
"pages/member/activity-post/activity-post"
,
"pages/activity/quiz-result/quiz-result"
,
"pages/activity/quiz-result/quiz-result"
,
"pages/activity/quiz-info/quiz-info"
,
"pages/activity/quiz-info/quiz-info"
,
"pages/activity/activity-info/activity-info"
,
"pages/activity/activity-info/activity-info"
,
"pages/key/key"
,
"pages/activity/act-address/act-address"
,
"pages/activity/act-address/act-address"
,
"pages/activity/act-writer/act-writer"
,
"pages/activity/act-writer/act-writer"
,
"pages/my/my"
,
"pages/my/my"
,
...
...
增值产品-小程序及app/nyx-master/component/calendar/index.wxss
查看文件 @
a7f26c3b
@impo
rt './theme/iconfont.wxss';
@impo
rt './theme/iconfont.wxss';
...
@@ -101,9 +101,10 @@
...
@@ -101,9 +101,10 @@
width: 14.286014285714286%;
width: 14.286014285714286%;
}
}
/* 高度调整=date+活动名 */
.date-wrap {
.date-wrap {
width: 100%;
width: 100%;
height:
18
5rpx;
height:
21
5rpx;
position: relative;
position: relative;
left: 0;
left: 0;
top: 0;
top: 0;
...
@@ -131,15 +132,15 @@
...
@@ -131,15 +132,15 @@
width: 100%;
width: 100%;
border-radius: 0;
border-radius: 0;
}
}
/* date之间高度 */
.date-desc {
.date-desc {
width: 280%;
width: 280%;
height: 1
3
0rpx;
height: 1
6
0rpx;
font-size: 26rpx;
font-size: 26rpx;
line-height: 32rpx;
line-height: 32rpx;
position: absolute;
position: absolute;
left: 50%;
left: 50%;
transform: translate(-50%, 9
5
%);
transform: translate(-50%, 9
1
%);
overflow: hidden;
overflow: hidden;
word-break: break-all;
word-break: break-all;
text-overflow: ellipsis;
text-overflow: ellipsis;
...
...
增值产品-小程序及app/nyx-master/icon/add.png
查看文件 @
a7f26c3b
26.2 KB
|
W:
|
H:
4.88 KB
|
W:
|
H:
2-up
Swipe
Onion skin
增值产品-小程序及app/nyx-master/icon/del.png
0 → 100644
查看文件 @
a7f26c3b
4.67 KB
增值产品-小程序及app/nyx-master/pages/activity/activity-info/activity-info.js
查看文件 @
a7f26c3b
// pa
ges/activity/activity-info/activity-info.js
// pa
ges/activity/activity-info/activity-info.js
...
@@ -211,5 +211,15 @@ Page({
...
@@ -211,5 +211,15 @@ Page({
});
});
},
},
//点击clone后跳转至活动创建页面
onClickClone
:
function
(
e
)
{
var
_this
=
this
;
var
url
=
"/pages/member/activity-post/activity-post?"
+
"&activity_id="
+
"aid_123"
wx
.
navigateTo
({
url
:
url
});
},
})
})
\ No newline at end of file
增值产品-小程序及app/nyx-master/pages/activity/activity-info/activity-info.wxml
查看文件 @
a7f26c3b
<view
class="page">
<view
class="page">
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
<view class="note-price" style="font-weight: bold">
<view class="note-price" style="font-weight: bold">
<view class="clone">
<view class="clone">
<view class="clone-left">¥{{activityInfo.unit_price}}</view>
<view class="clone-left">¥{{activityInfo.unit_price}}</view>
<view class="clone-right" bindtap="onClick
Points
" data-id='{{index}}'>
<view class="clone-right" bindtap="onClick
Clone
" data-id='{{index}}'>
<view class="note-column" style="font-size: 24rpx;font-weight:normal;color: #000;">
<view class="note-column" style="font-size: 24rpx;font-weight:normal;color: #000;">
<image src="../../../icon/activity/clone.png"></image>
<image src="../../../icon/activity/clone.png"></image>
克隆
克隆
...
...
增值产品-小程序及app/nyx-master/pages/activity/activity.js
查看文件 @
a7f26c3b
// pa
ges/activity/activity.js
// pa
ges/activity/activity.js
...
@@ -87,18 +87,23 @@ Page({
...
@@ -87,18 +87,23 @@ Page({
})
})
wx
.
setNavigationBarTitle
({
wx
.
setNavigationBarTitle
({
title
:
'酒肆活动'
,
title
:
'酒肆活动'
,
})
})
//初始载入四个推荐的竞答活动
//初始载入四个推荐的竞答活动
if
(
_this
.
__data__
.
activities
.
length
==
0
)
if
(
_this
.
__data__
.
activities
.
length
==
0
)
{
{
var
curIndex
=
_this
.
__data__
.
curIndex
var
switchId
=
app
.
globalData
.
switchId
var
curIndex
=
switchId
!=
""
?
switchId
:
_this
.
__data__
.
curIndex
var
strCategory
=
_this
.
__data__
.
category
[
curIndex
].
name
var
strCategory
=
_this
.
__data__
.
category
[
curIndex
].
name
this
.
setData
({
curIndex
:
curIndex
,
});
app
.
globalData
.
switchId
=
""
_this
.
getActivities
(
0
,
1
,
4
,
strCategory
);
_this
.
getActivities
(
0
,
1
,
4
,
strCategory
);
}
}
},
},
/**
/**
...
...
增值产品-小程序及app/nyx-master/pages/member/activity-post/activity-edit/activity-edit.js
0 → 100644
查看文件 @
a7f26c3b
// pages/member/activity-post/activity-edit/activity-edit.js
// pages/member/activity-post/activity-edit/activity-edit.js
var
config
=
wx
.
getStorageSync
(
"config"
);
var
app
=
getApp
();
var
log
=
require
(
'./../../../../utils/log.js'
)
var
util
=
require
(
'./../../../../utils/util.js'
)
Page
({
data
:
{
product_listData
:
[],
attributeArray
:
[
'活动类别'
,
'价格'
,
'库存'
],
},
onLoad
:
function
()
{
var
that
=
this
;
wx
.
getSystemInfo
({
success
:
function
(
res
)
{
var
a
=
res
.
windowHeight
;
that
.
setData
({
scrollTop
:
a
-
200
})
}
})
var
product_listData
=
[
{
product_desc
:
"会员"
,
unit_price
:
59.00
,
stock
:
10
,
},
{
product_desc
:
"普通用户"
,
unit_price
:
99.00
,
stock
:
10
,
},
]
this
.
setData
({
product_listData
:
product_listData
,
});
},
onReady
:
function
(
e
)
{
},
// Page Flow
navigateToSubmit
()
{
let
promise
=
app
.
onCheckText
(
app
.
globalData
.
postData
.
photoTag
)
//在本轮event loop(事件循环)运行完成之前,回调函数是不会被调用的
//then后的括号里应该是参数param
//https://www.cnblogs.com/qlongbg/p/11603328.html
promise
.
then
(
function
(
value
)
{
console
.
log
(
"===enter promise then_pass_"
+
value
)
wx
.
navigateTo
({
url
:
'./../activity-submit/activity-submit'
})
},
function
(
value
)
{
console
.
log
(
"===enter promise then_failed_"
+
value
)
},);
},
// Date Flow
// 输入该组图片的标签
bindKeyInput
(
e
)
{
var
_this
=
this
;
_this
.
setData
({
inputValue
:
e
.
detail
.
value
})
//全局赋值
app
.
globalData
.
postData
.
photoTag
=
e
.
detail
.
value
},
addList
:
function
(){
var
_this
=
this
;
var
list
=
_this
.
data
.
product_listData
;
var
newData
=
{
product_desc
:
"会员"
,
unit_price
:
59.00
,
stock
:
10
,
};
list
.
push
(
newData
);
//实质是添加lists数组内容,使for循环多一次
this
.
setData
({
product_listData
:
list
,
})
},
delList
:
function
(
e
)
{
var
_this
=
this
;
var
dataId
=
e
.
currentTarget
.
dataset
.
id
var
product_listData
=
_this
.
data
.
product_listData
;
product_listData
.
splice
(
dataId
,
1
);
this
.
setData
({
product_listData
:
product_listData
,
})
},
})
增值产品-小程序及app/nyx-master/pages/member/activity-post/activity-edit/activity-edit.json
0 → 100644
查看文件 @
a7f26c3b
{
{
"navigationBarTitleText"
:
"添加详情"
}
\ No newline at end of file
增值产品-小程序及app/nyx-master/pages/member/activity-post/activity-edit/activity-edit.wxml
0 → 100644
查看文件 @
a7f26c3b
<!-- /page/post/edit/edit 添加分类的标签,以及自定义标签 -->
<!-- /page/post/edit/edit 添加分类的标签,以及自定义标签 -->
<view class="page" style="height:100%;width:100%">
<block>
<button type="default" bindtap="navigateToSubmit">下一步</button>
</block>
<view class="weui-cells__title">#添加标题</view>
<view class="weui-cells weui-cells_after-title">
<view class="weui-cell ">
<view class="weui-cell__bd">
<input class="weui-input" bindinput="bindKeyInput" placeholder="请输入标题" />
</view>
</view>
</view>
<view class="weui-cells__title">#添加标签</view>
<view class="weui-cells weui-cells_after-title">
<view class="weui-cell ">
<view class="weui-cell__bd">
<input class="weui-input" bindinput="bindKeyInput" placeholder="请输入标签" />
</view>
</view>
</view>
<view class="weui-cells__title">#添加活动内容</view>
<!-- 添加表格: 序号, 类别描述, 价格, 个数 -->
<view class='table'>
<view class='table_header'>
<view class="th" style='width:70rpx;background-color:white'>
<view class='centerclass cell_label'>序号</view>
</view>
<block wx:for="{{attributeArray}}">
<view class='th'>
<view class="cell_label centerclass">{{item}}</view>
</view>
</block>
<view class="th" style='width:70rpx;background-color:white'>
<view class='centerclass cell_label'>
</view>
</view>
</view>
<block wx:for="{{product_listData}}" wx:for-item="item" wx:key="{{index}}">
<view class='table_main'>
<!--上午下午晚上 -->
<view class='td' style='width:70rpx;background-color:white;'>
<view class="cell_label centerclass">{{index}}</view>
</view>
<!-- 周一 -->
<view class='td'>
<view class='table_Text_last_class'>
{{item.product_desc}}
</view>
</view>
<view class='td'>
<view class='table_Text_last_class'>
{{item.unit_price}}
</view>
</view>
<view class='td'>
<view class='table_Text_last_class'>
{{item.stock}}
</view>
</view>
<!-- start 删除新行按钮 -->
<view class="th" style='width:70rpx;background-color:white'>
<view class='centerclass cell_label' bindtap='delList' data-id="{{index}}">
<image src="../../../../icon/del.png" style="width: 50rpx;height: 50rpx;"></image>
</view>
</view>
<!-- end 删除新行按钮 -->
</view>
</block>
<!-- start 添加新行按钮 -->
<view class='table_header'>
<view class="th" style='width:70rpx;background-color:white'>
<view class='centerclass cell_label' bindtap='addList'>
<image src="../../../../icon/add.png" style="width: 50rpx;height: 50rpx;"></image>
</view>
</view>
</view>
<!-- end 添加新行按钮 -->
</view>
</view>
\ No newline at end of file
增值产品-小程序及app/nyx-master/pages/member/activity-post/activity-edit/activity-edit.wxss
0 → 100644
查看文件 @
a7f26c3b
page{
page{
height: 100%;
background-color:#f5f8fa;
}
.post{
position: absolute;
bottom: 0;
right:0px;
}
/* 表格 */
.table{
display: inline-flex;
flex-direction: column;
border: 1rpx solid rgba(218, 217, 217, 1);
border-bottom: 0;
}
.scrollClass {
display: flex;
width: 100%;
white-space: nowrap;
margin-top: 23px;
height: 100%;
background-color: white;
}
.table_header {
display: inline-flex;
}
.th {
display: flex;
flex-direction: column;
width: 200rpx;
height: 90rpx;
background: rgba(241, 252, 255, 1);
border-right: 1rpx solid rgba(218, 217, 217, 1);
border-bottom: 1rpx solid rgba(218, 217, 217, 1);
justify-content: center;
align-items: center;
overflow-x: auto;
}
.cell_label{
font-size: 26rpx;
color: rgba(74, 74, 74, 1);
}
.cell_date_label{
font-size: 20rpx;
color: rgba(74, 74, 74, 1);
}
.table_main {
display: inline-flex;
flex-direction: row;
}
.right-item{
display: flex;
flex-direction: row;
}
.td {
display: flex;
flex-direction: column;
width: 200rpx;
/* height: 90rpx; */
background: white;
justify-content: center;
align-items: center;
border: 1rpx solid rgba(218, 217, 217, 1);
border-top: 0;
border-left:0;
}
.table_Text_class {
display: flex;
justify-content: center;
align-items: center;
height: 60rpx;
font-size: 30rpx;
color: rgba(55, 134, 244, 1);
width: 100%;
word-break: normal;
border-bottom: 1rpx solid rgba(218, 217, 217, 1);
}
.table_Text_last_class{
display: flex;
justify-content: center;
align-items: center;
height: 60rpx;
font-size: 30rpx;
color: rgba(55, 134, 244, 1);
width: 100%;
word-break: normal;
}
\ No newline at end of file
增值产品-小程序及app/nyx-master/pages/member/activity-post/activity-post.js
0 → 100644
查看文件 @
a7f26c3b
// pages/member/activity-post/activity-post.js
// pages/member/activity-post/activity-post.js
var
config
=
wx
.
getStorageSync
(
"config"
);
var
app
=
getApp
();
var
log
=
require
(
'./../../../utils/log.js'
)
var
util
=
require
(
'./../../../utils/util.js'
)
/*
提交流程
1. post.js 生成图片的临时路径
2. edit.js 编辑标签
3. submit.js 上传阿里云oss, 将内容上传到数据库
- 获取token
- 上传oss
- 上传数据库
*/
const
base64
=
require
(
'./../../../utils/base64.js'
);
//Base64,hmac,sha1,crypto相关算法
Page
({
onLoad
:
function
()
{
var
that
=
this
;
wx
.
getSystemInfo
({
success
:
function
(
res
)
{
var
a
=
res
.
windowHeight
;
that
.
setData
({
scrollTop
:
a
-
200
})
}
})
},
data
:
{
photoArray
:
[],
sourceTypeIndex
:
2
,
sourceType
:
[
'拍照'
,
'相册'
,
'拍照或相册'
],
sizeTypeIndex
:
2
,
sizeType
:
[
'压缩'
,
'原图'
,
'压缩或原图'
],
countIndex
:
8
,
count
:
[
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
],
//定义图片尺寸
imageSize
:
''
,
},
sourceTypeChange
(
e
)
{
this
.
setData
({
sourceTypeIndex
:
e
.
detail
.
value
})
},
sizeTypeChange
(
e
)
{
this
.
setData
({
sizeTypeIndex
:
e
.
detail
.
value
})
},
countChange
(
e
)
{
this
.
setData
({
countIndex
:
e
.
detail
.
value
})
},
//在进入页面时就执行,用于初始化
onReady
:
function
(
e
)
{
},
// Page Flow
navigateToEdit
()
{
var
_this
=
this
;
var
newFilePaths
=
_this
.
data
.
photoArray
// let promise = app.onCheckPic(newFilePaths)
// //在本轮event loop(事件循环)运行完成之前,回调函数是不会被调用的
// //then后的括号里应该是参数param
// //https://www.cnblogs.com/qlongbg/p/11603328.html
// promise.then(function (value) {
// console.log("===checkPic_enter promise then_" + value)
// //同步更新全局变量
// app.globalData.postData.photoArray = newFilePaths
// wx.navigateTo({ url: './edit/edit' })
// });
app
.
globalData
.
postData
.
photoArray
=
newFilePaths
wx
.
navigateTo
({
url
:
'./activity-edit/activity-edit'
})
},
// Date Flow
/*
step1: 选定图片,可以预览
step2: 添加描述文字,选择tag
step3: 上传
1. chooseImage
2. 进行图片编辑
3. 点击下一步验证图片是否合法合规 navigateToEdit
通过size或其他方式判断是否进行图片处理(裁切,填满,留白,充满)
1) > 2M会出现 45002, content size out of limit 错误
2) 自动裁剪成4:3 或 1:1
*/
addPhoto
:
function
(
res
)
{
var
_this
=
this
;
_this
.
setData
({
photoArray
:
[]
})
console
.
log
(
"===this is addPhoto"
);
wx
.
chooseImage
({
sizeType
:
[
'original, compressed'
],
// 可以指定是原图还是压缩图,默认二者都有
sourceType
:
[
'album'
,
'camera'
],
// 可以指定来源是相册还是相机,默认二者都有
success
:
function
(
res
)
{
var
canvasId
=
"photoCanvasId"
;
console
.
log
(
"===addPhoto_上传图片参数"
,
res
)
_this
.
onEditPic
(
res
,
canvasId
)
}
})
},
previewImage
(
e
)
{
const
current
=
e
.
target
.
dataset
.
src
wx
.
previewImage
({
current
,
urls
:
this
.
data
.
photoArray
})
},
//保存图形的tmp地址
saveData
(
newFilePaths
){
var
_this
=
this
;
console
.
log
(
"===saveData"
,
newFilePaths
)
_this
.
setData
({
photoArray
:
newFilePaths
})
app
.
globalData
.
postData
.
photoArray
=
newFilePaths
;
},
//小程序图片处理主函数
editPic
(
tempFilePaths
,
index
,
canvasId
)
{
var
_this
=
this
;
var
photoArray
=
_this
.
data
.
photoArray
if
(
index
<
tempFilePaths
.
length
){
var
pic
=
tempFilePaths
[
index
]
wx
.
getImageInfo
({
src
:
pic
,
//图片的路径,可以是相对路径,临时文件路径,存储文件路径,网络图片路径,
success
:
function
(
res
)
{
// util.imageUtil 用于计算长宽比
var
i
=
index
+
1
console
.
log
(
"第"
+
i
+
"张上传图片参数"
,
res
)
var
imageSize
=
util
.
imageUtil
(
res
);
console
.
log
(
"success on getImageInfo_"
+
index
);
console
.
log
(
imageSize
)
_this
.
setData
({
imageSize
:
imageSize
})
const
ctx
=
wx
.
createCanvasContext
(
canvasId
);
//ctx.drawImage(pic, 0, 0, imageSize.swidth, imageSize.sheight);
ctx
.
drawImage
(
pic
,
imageSize
.
sx
,
imageSize
.
sy
,
imageSize
.
swidth
,
imageSize
.
sheight
,
imageSize
.
x
,
imageSize
.
y
,
imageSize
.
width
,
imageSize
.
height
);
// 需要注意的是 draw 方法是异步的,如果图片还没加载成功,有可能画出来的是空的
// 所以 draw 方法通常都会带有定时器这样的回调
ctx
.
draw
(
false
,
setTimeout
(
function
()
{
//ctx.draw(false, function () {
var
i
=
index
+
1
console
.
log
(
"==enter draw_"
+
i
);
wx
.
canvasToTempFilePath
({
canvasId
:
canvasId
,
fileType
:
"jpg"
,
success
:
function
(
res
)
{
console
.
log
(
"===success_"
,
res
)
console
.
log
(
"===第"
+
i
+
"图处理成功"
)
photoArray
.
push
(
res
.
tempFilePath
)
_this
.
setData
({
photoArray
:
photoArray
})
index
=
index
+
1
_this
.
editPic
(
tempFilePaths
,
index
,
canvasId
);
// 用于多个图片压缩
},
fail
:
function
(
e
)
{
var
i
=
index
+
1
console
.
log
(
"===第"
+
i
+
"图处理失败"
)
}
});
},
1000
));
//});
},
fail
:
function
(
e
)
{
console
.
log
(
"failed"
,
e
);
},
complete
:
function
(
e
)
{
var
i
=
index
+
1
console
.
log
(
"complete on getImageInfo_"
+
i
,
e
);
}
})
}
},
// 通过size或其他方式判断是否进行图片处理(裁切,填满,留白,充满)
// 1) > 2M会出现45002, content size out of limit错误
// 2) 自动裁剪成4:3(高/宽 1080) 或 1:1 有品默认1:1
// refer1 微信小程序图片压缩 https://www.jianshu.com/p/1b8a1e96a6d5
// refer2 小程序压缩图片(canvas) https://www.jianshu.com/p/ec1f95008dce
onEditPic
(
res
,
canvasId
)
{
var
_this
=
this
;
var
tempFilePaths
=
res
.
tempFilePaths
;
var
index
=
0
;
_this
.
editPic
(
tempFilePaths
,
index
,
canvasId
)
}
})
增值产品-小程序及app/nyx-master/pages/member/activity-post/activity-post.json
0 → 100644
查看文件 @
a7f26c3b
{
{
"navigationBarTitleText"
:
"活动创建"
}
\ No newline at end of file
增值产品-小程序及app/nyx-master/pages/member/activity-post/activity-post.wxml
0 → 100644
查看文件 @
a7f26c3b
<!-- /pages/member/activity-post/activity-post.wxml -->
<!-- /pages/member/activity-post/activity-post.wxml -->
<view class="page" style="height:100%;width:100%">
<block>
<button type="default" bindtap="navigateToEdit">下一步</button>
</block>
<form>
<view class="weui-cells">
<view class="weui-cell">
<view class="weui-cell__bd">
<view class="weui-uploader">
<view class="weui-uploader__hd">
<view class="weui-uploader__title">图片上传</view>
<view class="weui-uploader__info">{{photoArray.length}}/{{count[countIndex]}}</view>
</view>
<view class="weui-uploader__bd">
<view class="weui-uploader__files">
<block wx:for="{{photoArray}}" wx:for-item="image">
<view class="weui-uploader__file">
<image class="weui-uploader__img" src="{{image}}" data-src="{{image}}" bindtap="previewImage"></image>
</view>
</block>
</view>
<view class="weui-uploader__input-box">
<view class="weui-uploader__input" bindtap="addPhoto"></view>
</view>
</view>
</view>
</view>
</view>
</view>
</form>
<canvas canvas-id='photoCanvasId' class='myCanvas' style='width:{{imageSize.width}}px;height:{{imageSize.height}}px'>
</canvas>
</view>
\ No newline at end of file
增值产品-小程序及app/nyx-master/pages/member/activity-post/activity-post.wxss
0 → 100644
查看文件 @
a7f26c3b
page{
page{
height: 100vh;
background-color:#f5f8fa;
}
.banner{
position: relative;
}
.banner image{
height: 200px;
width:100%;
}
.post{
position: absolute;
bottom: 0;
right:0px;
}
.banner .play{
width: 40px;
height: 40px;
position: absolute;
bottom: 10px;
right:10px;
z-index: 10;
}
.mdetail{
overflow: hidden;
height:55px;
padding:5px 10px;
border-bottom:1px solid #dbdbdb;
}
.mdetail image{
float:left;
width:55px;
height:55px;
}
.minfo{
float:left;
margin-left:10px;
padding:10px 0;
}
.detailLeft{
float:left;
}
.detailRight{
float:right;
}
.mname{
font-size: 14px;
margin-bottom:10px;
}
.mauthor{
font-size: 12px;
color:#dbdbdb;
}
/*
隐藏 canvas,避免显示错误
*/
.myCanvas {
position: absolute;
top: -9999px;
left: -9999px;
}
增值产品-小程序及app/nyx-master/pages/member/activity-post/activity-submit/activity-submit.js
0 → 100644
查看文件 @
a7f26c3b
// pages/member/activity-post/activity-submit/activity-submit.js
// pages/member/activity-post/activity-submit/activity-submit.js
const
base64
=
require
(
'../../../../utils/base64.js'
);
//Base64,hmac,sha1,crypto相关算法
var
config
=
wx
.
getStorageSync
(
"config"
);
var
app
=
getApp
();
Page
({
onLoad
:
function
()
{
var
that
=
this
;
wx
.
getSystemInfo
({
success
:
function
(
res
)
{
var
a
=
res
.
windowHeight
;
that
.
setData
({
scrollTop
:
a
-
200
})
}
})
},
data
:
{
//阿里云 OSS相关参数
accessid
:
""
,
policy
:
""
,
signature
:
""
,
host
:
""
,
dir
:
""
,
expire
:
""
,
securityToken
:
""
,
//评论标题+内容相关参数
inputTitle
:
""
,
inputContent
:
""
,
},
onReady
:
function
(
e
)
{
var
_this
=
this
;
//进入页面就自动获取oss参数
_this
.
oss
();
},
// Date Flow
// 提交oss和数据库
onSubmitPost
:
function
(
e
)
{
var
_this
=
this
;
var
title
=
e
.
detail
.
value
.
inputTitle
;
//获取title
var
content
=
e
.
detail
.
value
.
inputContent
;
//获取content
app
.
globalData
.
postData
.
title
=
title
app
.
globalData
.
postData
.
content
=
content
if
(
content
!=
undefined
&&
content
!=
""
)
{
//step1, 上传至oss-获取token,在onReady()提前准备
//_this.oss();
//step2, 判断文本是否合规
let
promise
=
app
.
onCheckText
(
title
+
content
)
//在本轮event loop(事件循环)运行完成之前,回调函数是不会被调用的
//then后的括号里应该是参数param
//https://www.cnblogs.com/qlongbg/p/11603328.html
promise
.
then
(
function
(
value
)
{
console
.
log
(
"===enter promise then_pass_"
+
value
)
//step3, 上传至oss-上传图片
//_this.releaseOss(title, content);
_this
.
switchTab
()
},
function
(
value
)
{
console
.
log
(
"===enter promise then_failed_"
+
value
)
});
//step4, 上传信息到数据库
//上传数据库在oss sdk的callback函数里设置
//需要java后台支持
}
},
oss
:
function
()
{
var
_this
=
this
;
console
.
log
(
"===this is oss"
);
//token信息
var
strUrl
=
config
.
oss_token_url
+
"?tokenName=ios&userName=1234"
wx
.
request
({
url
:
strUrl
,
method
:
'GET'
,
header
:
{
'content-type'
:
'application/json'
},
success
:
res
=>
{
if
(
res
.
statusCode
==
200
)
{
console
.
log
(
"=== oss getToken 返回值_"
,
res
.
data
)
_this
.
setData
({
accessid
:
res
.
data
.
data
.
accessid
,
policy
:
res
.
data
.
data
.
policy
,
signature
:
res
.
data
.
data
.
signature
,
host
:
res
.
data
.
data
.
host
,
dir
:
res
.
data
.
data
.
dir
,
expire
:
res
.
data
.
data
.
expire
,
securityToken
:
res
.
data
.
data
.
securityToken
,
})
}
}
})
},
//上传照片(阿里云)
uploadAli
:
function
(
tag
,
title
,
content
,
photoArr
)
{
var
_this
=
this
;
console
.
log
(
"===uploadAli_data_tag: "
,
tag
)
console
.
log
(
"===uploadAli_data_title: "
,
title
)
console
.
log
(
"===uploadAli_data_content: "
,
content
)
console
.
log
(
"===uploadAli_data_photoArr: "
,
photoArr
)
var
promise
=
Promise
.
all
(
photoArr
.
map
((
pic
,
index
)
=>
{
//pic是多图上传模式中的单张图片 index => 0 : length-1
console
.
log
(
pic
)
//传给阿里云的参数
var
policy
=
this
.
data
.
policy
;
var
accessid
=
this
.
data
.
accessid
;
var
securityToken
=
this
.
data
.
securityToken
;
var
signature
=
this
.
data
.
signature
;
var
path
=
this
.
data
.
host
+
"/"
+
this
.
data
.
dir
;
console
.
log
(
"policy: "
+
policy
);
console
.
log
(
"signature: "
+
signature
);
console
.
log
(
"accessid: "
+
accessid
);
console
.
log
(
"path: "
+
path
)
var
babyData
=
{
'Filename'
:
'${filename}'
,
'name'
:
pic
.
replace
(
'http://tmp/'
,
""
).
replace
(
'wxfile://'
,
""
),
'key'
:
this
.
data
.
dir
+
'${filename}'
,
'policy'
:
policy
,
'OSSAccessKeyId'
:
accessid
,
'success_action_status'
:
'200'
,
//让服务端返回200,不然,默认会返回204
'signature'
:
signature
,
'x-oss-security-token'
:
securityToken
}
// 多图n上传流程,通过promise.all实现异步控制
// n-1图直接上传
// 第n图上传+设置callback,在java后台提交参数到数据库
if
(
index
==
photoArr
.
length
-
1
)
{
var
photoArrsm
=
[];
//由于微信小程序生成的临时路径在上传阿里云的时候不需要上传.所以需要对路径进行处理,但是在手机端上传和PC端上传,图片临时路径的前缀不同,所以需要进行分别的处理
// pc: http://tmp/
// wx: wxfile://
for
(
let
i
=
0
;
i
<
photoArr
.
length
;
i
++
)
{
photoArrsm
.
push
(
path
+
photoArr
[
i
].
replace
(
'http://tmp/'
,
""
).
replace
(
'wxfile://'
,
""
));
}
//生成最终的文件字符串 file1.jpg::file2.png (数据库解析格式)
var
image
=
photoArrsm
.
join
(
"::"
)
var
userId
=
wx
.
getStorageSync
(
'nyxCode'
)
var
strUrl
=
config
.
oss_callback_url
var
callback_param
=
{
'callbackUrl'
:
strUrl
,
'callbackBody'
:
'filename=${object}&size=${size}&mimeType=${mimeType}&height=${imageInfo.height}&width=${imageInfo.width}&tag='
+
encodeURI
(
encodeURI
(
tag
))
+
'&title='
+
encodeURI
(
encodeURI
(
title
))
+
'&content='
+
encodeURI
(
encodeURI
(
content
))
+
'&image='
+
image
+
'&userId='
+
userId
,
'callbackBodyType'
:
"application/x-www-form-urlencoded"
,
}
var
base64_callback_body
=
base64
.
encode
(
JSON
.
stringify
(
callback_param
));
babyData
[
'callback'
]
=
base64_callback_body
}
return
new
Promise
(
function
(
resolve
,
reject
)
{
var
host
=
_this
.
data
.
host
;
wx
.
uploadFile
({
url
:
host
,
formData
:
babyData
,
name
:
'file'
,
filePath
:
pic
,
header
:
{
'content-type'
:
'multipart/form-data'
},
success
:
function
(
res
)
{
console
.
log
(
"=== index_"
+
index
)
console
.
log
(
res
)
resolve
(
res
.
data
);
},
fail
:
function
(
err
)
{
reject
(
new
Error
(
'failed to upload file'
));
console
.
log
(
"fail to upload file"
)
},
complete
:
function
()
{
console
.
log
(
"complete to upload file"
);
}
});
});
})).
then
(
_this
.
switchTab
());
},
//发布按钮
releaseOss
:
function
(
title
,
content
)
{
var
_this
=
this
;
console
.
log
(
"===this is releaseOss"
);
//获取照片数组
var
photoArr
=
app
.
globalData
.
postData
.
photoArray
;
//时间搓
var
expire
=
this
.
data
.
expire
;
//获取当前时间搓
var
expireNow
=
Date
.
parse
(
new
Date
())
/
1000
;
//如果当前时间大于获取的时间 则重新获取oss;
if
(
expire
==
undefined
||
expireNow
>
expire
)
{
//重新获取oss
_this
.
oss
();
expire
=
this
.
data
.
expire
;
}
var
tag
=
app
.
globalData
.
postData
.
photoTag
this
.
uploadAli
(
tag
,
title
,
content
,
photoArr
)
},
switchTab
()
{
//跳转到/activity.wxml页面
app
.
globalData
.
switchId
=
1
wx
.
switchTab
({
url
:
'/pages/activity/activity'
});
},
})
增值产品-小程序及app/nyx-master/pages/member/activity-post/activity-submit/activity-submit.json
0 → 100644
查看文件 @
a7f26c3b
{
{
"navigationBarTitleText"
:
"活动发布"
}
\ No newline at end of file
增值产品-小程序及app/nyx-master/pages/member/activity-post/activity-submit/activity-submit.wxml
0 → 100644
查看文件 @
a7f26c3b
<view class="post" style="height:100%;width:100%">
<view class="post" style="height:100%;width:100%">
<view class="page-body">
<form catchsubmit="onSubmitPost" >
<view class="btn-area">
<button type="normal" formType="submit">活动发布</button>
</view>
<view class="weui-cells__title">#添加内容</view>
<view class="weui-cells weui-cells_after-title">
<view class="weui-cell">
<view class="weui-cell__bd">
<textarea class="weui-textarea" bindinput='bindKeyInput' name="inputContent" placeholder="请输入内容" style="height: 3.3em" />
<view class="weui-textarea-counter">{{inputContent.length}}/300</view>
</view>
</view>
</view>
</form>
</view>
</view>
\ No newline at end of file
增值产品-小程序及app/nyx-master/pages/member/activity-post/activity-submit/activity-submit.wxss
0 → 100644
查看文件 @
a7f26c3b
page{
page{
height: 100%;
background-color:#f5f8fa;
}
.post{
position: absolute;
bottom: 0;
right:0px;
}
增值产品-小程序及app/nyx-master/pages/member/schedule/schedule.js
查看文件 @
a7f26c3b
// pa
ges/schedule/schedule.js
// pa
ges/schedule/schedule.js
...
@@ -139,47 +139,62 @@ Page({
...
@@ -139,47 +139,62 @@ Page({
{
{
year
:
2020
,
year
:
2020
,
month
:
8
,
month
:
8
,
day
:
23
,
day
:
15
,
todoText
:
'
夏日精酿夜
\
n红酒生蚝趴
'
,
todoText
:
'
周年庆
\
n烤肉海鲜自助
'
,
color
:
'#f40'
// 单独定义代办颜色 (标记点、文字)
color
:
'#f40'
// 单独定义代办颜色 (标记点、文字)
}
},
]
});
this
.
calendar
.
setTodoLabels
({
// 待办点标记设置
pos
:
'bottom'
,
// 待办点标记位置 ['top', 'bottom']
dotColor
:
''
,
// 待办点标记颜色
circle
:
false
,
// 待办圆圈标记设置(如圆圈标记已签到日期),该设置与点标记设置互斥
showLabelAlways
:
false
,
// 点击时是否显示待办事项(圆点/文字),在 circle 为 true 及当日历配置 showLunar 为 true 时,此配置失效
days
:
[
{
{
year
:
2020
,
year
:
2020
,
month
:
8
,
month
:
8
,
day
:
30
,
day
:
8
,
todoText
:
'
夏日精酿夜
\
n红酒生蚝趴
'
,
todoText
:
'
599/6瓶套装
'
,
color
:
'#f40'
// 单独定义代办颜色 (标记点、文字)
color
:
'#f40'
// 单独定义代办颜色 (标记点、文字)
}
},
]
});
this
.
calendar
.
setTodoLabels
({
// 待办点标记设置
pos
:
'bottom'
,
// 待办点标记位置 ['top', 'bottom']
dotColor
:
''
,
// 待办点标记颜色
circle
:
false
,
// 待办圆圈标记设置(如圆圈标记已签到日期),该设置与点标记设置互斥
showLabelAlways
:
false
,
// 点击时是否显示待办事项(圆点/文字),在 circle 为 true 及当日历配置 showLunar 为 true 时,此配置失效
days
:
[
{
{
year
:
2020
,
year
:
2020
,
month
:
8
,
month
:
8
,
day
:
31
,
day
:
16
,
todoText
:
'
新西兰活动周
\
n盲品活动
\
n
品鉴会'
,
todoText
:
'
帝王嘉
品鉴会'
,
color
:
'#f40'
// 单独定义代办颜色 (标记点、文字)
color
:
'#f40'
// 单独定义代办颜色 (标记点、文字)
}
},
{
year
:
2020
,
month
:
8
,
day
:
3
,
todoText
:
'盲品活动'
,
color
:
'#f40'
// 单独定义代办颜色 (标记点、文字)
},
{
year
:
2020
,
month
:
8
,
day
:
1
,
todoText
:
'埃特纳红葡'
,
color
:
'#f40'
// 单独定义代办颜色 (标记点、文字)
},
{
year
:
2020
,
month
:
8
,
day
:
13
,
todoText
:
'陈年主题专场'
,
color
:
'#f40'
// 单独定义代办颜色 (标记点、文字)
},
{
year
:
2020
,
month
:
8
,
day
:
8
,
todoText
:
'红丹魄白丹魄'
,
color
:
'#f40'
// 单独定义代办颜色 (标记点、文字)
},
]
]
});
});
},
},
...
...
增值产品-小程序及app/nyx-master/pages/my/my-members/my-members.wxml
查看文件 @
a7f26c3b
<!--p
ages/my/my-members/my-members.wxml-->
<!--p
ages/my/my-members/my-members.wxml-->
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
<text class="title">活动</text>
<text class="title">活动</text>
<view class="list">
<view class="list">
<view class="items">
<view class="items">
<navigator url="
matchStudyDetail/matchStudyDetail?studyType=wset1
">
<navigator url="
/pages/member/activity-post/activity-post
">
<image src="/icon/my/activity.png"></image>
<image src="/icon/my/activity.png"></image>
</navigator>
</navigator>
<text>活动创建</text>
<text>活动创建</text>
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论