Bläddra i källkod

小程序新增专辑

wrh 2 år sedan
förälder
incheckning
31f2892aad

+ 2 - 1
nngkxxdp/src/main/resources/static/nnzwminiapp/app.json

@@ -16,7 +16,8 @@
 		"pages/dataCenter/dataCenter",
 		"pages/dataCenterXXTJ/dataCenterXXTJ",
 		"pages/album/album",
-		"pages/albumDetail/albumDetail"
+		"pages/albumDetail/albumDetail",
+		"pages/albumEdit/albumEdit"
 	],
 	"window": {
 		"backgroundTextStyle": "light",

+ 5 - 0
nngkxxdp/src/main/resources/static/nnzwminiapp/pages/album/album.js

@@ -95,6 +95,11 @@ Page({
 			url: '/pages/albumDetail/albumDetail',
 		})
 	},
+	toYXNAEdit(){
+		wx.navigateTo({
+			url: '/pages/albumEdit/albumEdit',
+		})
+	},
 
 	/**
 	 * 生命周期函数--监听页面初次渲染完成

+ 1 - 1
nngkxxdp/src/main/resources/static/nnzwminiapp/pages/album/album.wxml

@@ -22,7 +22,7 @@
 						<view style="overflow: hidden;font-size: 24rpx;font-weight: 500;line-height: 36rpx;height: 148rpx;text-overflow: ellipsis;-webkit-line-clamp:4;display: -webkit-box;-webkit-box-orient:vertical;">{{albumInfo.introduction}}</view>
 					</view>
 				</view>
-				<view style="display: flex;justify-content: space-between;flex-wrap: wrap;padding: 0 22rpx 20rpx 22rpx;">
+				<view bindtap="toYXNAEdit" style="display: flex;justify-content: space-between;flex-wrap: wrap;padding: 0 22rpx 20rpx 22rpx;">
 					<view style="width: 339rpx;height: 384rpx;background: #FFFFFF;box-shadow: 0 7rpx 10rpx 0 rgba(27,58,123,0.13);border-radius: 10rpx;margin: 10rpx 0" wx:for="{{albumInfo.albumList}}" wx:key="index">
 						<view>
 							<image src="{{imgUrl}}{{item.url}}" style="width: 339rpx;height: 191rpx;border-radius: 10rpx 10rpx 0 0;" />

+ 133 - 0
nngkxxdp/src/main/resources/static/nnzwminiapp/pages/albumEdit/albumEdit.js

@@ -0,0 +1,133 @@
+// pages/albumEdit/albumEdit.js
+Page({
+
+	/**
+	 * 页面的初始数据
+	 */
+	data: {
+		date: '2021-01-01',
+		index: 0,
+		array: ['美国', '中国', '巴西', '日本'],
+	},
+	// 提交
+	formSubmit(e) {
+		console.log('form发生了submit事件,携带数据为:', e.detail.value)
+	},
+	// 上传图片
+	bindUpload: function (e) {
+		var that = this
+		wx.chooseMedia({
+			count: that.data.count, // 默认3
+			sizeType: ["original", "compressed"], // 可以指定是原图还是压缩图,默认二者都有
+			sourceType: ["album", "camera"], // 可以指定来源是相册还是相机,默认二者都有
+			success: function (res) {
+				// 返回选定照片的本地文件路径列表,tempFilePath可以作为img标签的src属性显示图片
+				var tempFilePaths = res.tempFilePaths
+				for (var i = 0; i < tempFilePaths.length; i++) {
+					wx.uploadFile({
+						url: 'https://graph.baidu.com/upload',
+						filePath: tempFilePaths[i],
+						name: "file",
+						header: {
+							"content-type": "multipart/form-data"
+						},
+						success: function (res) {
+							if (res.statusCode == 200) {
+								wx.showToast({
+									title: "上传成功",
+									icon: "none",
+									duration: 1500
+								})
+
+								that.data.imgs.push(JSON.parse(res.data).data)
+
+								that.setData({
+									imgs: that.data.imgs
+								})
+							}
+						},
+						fail: function (err) {
+							wx.showToast({
+								title: "上传失败",
+								icon: "none",
+								duration: 2000
+							})
+						},
+						complete: function (result) {
+							console.log(result.errMsg)
+						}
+					})
+				}
+			}
+		})
+	},
+	// 日期切换
+	bindDateChange(e) {
+		console.log('picker发送选择改变,携带值为', e.detail.value)
+		this.setData({
+			date: e.detail.value
+		})
+	},
+	// 作品年代切换
+	bindPickerChange: function (e) {
+		console.log('picker发送选择改变,携带值为', e.detail.value)
+		this.setData({
+			index: e.detail.value
+		})
+	},
+	/**
+	 * 生命周期函数--监听页面加载
+	 */
+	onLoad(options) {
+
+	},
+
+	/**
+	 * 生命周期函数--监听页面初次渲染完成
+	 */
+	onReady() {
+
+	},
+
+	/**
+	 * 生命周期函数--监听页面显示
+	 */
+	onShow() {
+
+	},
+
+	/**
+	 * 生命周期函数--监听页面隐藏
+	 */
+	onHide() {
+
+	},
+
+	/**
+	 * 生命周期函数--监听页面卸载
+	 */
+	onUnload() {
+
+	},
+
+	/**
+	 * 页面相关事件处理函数--监听用户下拉动作
+	 */
+	onPullDownRefresh() {
+
+	},
+
+	/**
+	 * 页面上拉触底事件的处理函数
+	 */
+	onReachBottom() {
+
+	},
+
+	/**
+	 * 用户点击右上角分享
+	 */
+	onShareAppMessage() {
+
+	}
+})

+ 4 - 0
nngkxxdp/src/main/resources/static/nnzwminiapp/pages/albumEdit/albumEdit.json

@@ -0,0 +1,4 @@
+{
+	"usingComponents": {},
+	"navigationBarTitleText": "我要投稿"
+}

+ 72 - 0
nngkxxdp/src/main/resources/static/nnzwminiapp/pages/albumEdit/albumEdit.wxml

@@ -0,0 +1,72 @@
+<!--pages/albumEdit/albumEdit.wxml-->
+<view style="background: #F0F0F0;height: 98vh;padding-top: 20rpx;">
+	<form catchsubmit="formSubmit">
+		<view style="width: 700rpx;background: #FFFFFF;border-radius: 10rpx;margin: auto;">
+			<view style="display: flex;border-bottom: 1px solid #DDDDDD;margin: 20rpx 18rpx;">
+				<view style="font-size: 24rpx;display: flex;line-height: 70rpx;height: 70rpx;">
+					<view style="color: #A91919;">*</view>
+					<view style="width: 132rpx;">作者电话</view>
+				</view>
+				<input name="phone" style="font-size: 24rpx;line-height: 70rpx;height: 70rpx;width: 100%;" placeholder="请输入电话" />
+				<switch name="switchPhone" style="line-height: 60rpx;" />
+			</view>
+			<view style="display: flex;border-bottom: 1px solid #DDDDDD;margin: 20rpx 18rpx;">
+				<view style="font-size: 24rpx;display: flex;line-height: 70rpx;height: 70rpx;">
+					<view style="color: #A91919;">*</view>
+					<view style="width: 132rpx;">作品名称</view>
+				</view>
+				<input name="name" style="font-size: 24rpx;line-height: 70rpx;height: 70rpx;width: 100%;" placeholder="请输入作品名称" />
+			</view>
+			<view style="display: flex;border-bottom: 1px solid #DDDDDD;margin: 20rpx 18rpx;">
+				<view style="font-size: 24rpx;display: flex;line-height: 70rpx;height: 70rpx;">
+					<view style="color: #A91919;">*</view>
+					<view style="width: 132rpx;">作品作者</view>
+				</view>
+				<input name="author" style="font-size: 24rpx;line-height: 70rpx;height: 70rpx;width: 100%;" placeholder="请输入作品作者" />
+				<switch name="switchAuthor" style="line-height: 60rpx;" />
+			</view>
+			<view style="display: flex;border-bottom: 1px solid #DDDDDD;margin: 20rpx 18rpx;">
+				<view style="font-size: 24rpx;display: flex;line-height: 70rpx;height: 70rpx;">
+					<view style="color: #A91919;">*</view>
+					<view style="width: 132rpx;">归属如期</view>
+				</view>
+				<picker name="date" mode="date" value="{{date}}" bindchange="bindDateChange" style="line-height: 70rpx;font-size: 24rpx;">
+					<view>{{date}}</view>
+				</picker>
+			</view>
+			<view style="display: flex;border-bottom: 1px solid #DDDDDD;margin: 20rpx 18rpx;">
+				<view style="font-size: 24rpx;display: flex;line-height: 70rpx;height: 70rpx;">
+					<view style="color: #A91919;">*</view>
+					<view style="width: 132rpx;">作品年代</view>
+				</view>
+				<picker name="age" bindchange="bindPickerChange" value="{{index}}" range="{{array}}" style="line-height: 70rpx;font-size: 24rpx;">
+					{{array[index]}}
+				</picker>
+			</view>
+			<view style="display: flex;border-bottom: 1px solid #DDDDDD;margin: 20rpx 18rpx;">
+				<view style="font-size: 24rpx;display: flex;line-height: 70rpx;height: 70rpx;">
+					<view style="color: #A91919;">*</view>
+					<view style="width: 132rpx;">我的作品</view>
+				</view>
+				<view>
+					<view>
+						<button bindtap="bindUpload" style="width: 166rpx;height: 60rpx;background: #004A93;border-radius: 10rpx;color: #FFFFFF;font-size: 24rpx;line-height: 30rpx;margin: 0;">上传</button>
+					</view>
+					<view style="font-size: 24rpx;color: #D2D2D2;">支持jpg. png格式,大小在5M以下</view>
+					<view>
+						<image src="{{imgURl}}{{img}}"></image>
+						<input name="img" style="display: none;" value="{{imgURl}}{{img}}" type="text"/>
+					</view>
+				</view>
+			</view>
+			<view style="display: flex;margin: 20rpx 18rpx;height: 200rpx;">
+				<view style="font-size: 24rpx;display: flex;line-height: 70rpx;height: 70rpx;">
+					<view style="color: #A91919;">*</view>
+					<view style="width: 132rpx;">作品描述</view>
+				</view>
+				<textarea name="detail" style="font-size: 24rpx;padding-top: 20rpx;" bindblur="bindTextAreaBlur" auto-height placeholder="请输入你的作品描述" />
+			</view>
+		</view>
+		<button formType="submit" style="margin-top: 77rpx;width: 676rpx;height: 80rpx;background: #004A93;border-radius: 10rpx;color: #FFFFFF;font-size: 24rpx;line-height: 50rpx;">确认提交</button>
+	</form>
+</view>

+ 1 - 0
nngkxxdp/src/main/resources/static/nnzwminiapp/pages/albumEdit/albumEdit.wxss

@@ -0,0 +1 @@
+/* pages/albumEdit/albumEdit.wxss */