1
0

2 Коммиты 2a3a8511af ... aefe2ede63

Автор SHA1 Сообщение Дата
  lyqu aefe2ede63 Merge branch 'master' of http://192.168.1.218:3000/liyingqu/cyzh-SoundOfMusic-H5 4 лет назад
  lyqu e73a3770a7 修改 4 лет назад

+ 9 - 1
pages.json

@@ -268,7 +268,15 @@
                 "navigationBarTitleText": "绑定银行卡"
             }
             
-        }
+        },
+		{
+			"path": "uview-ui/components/u-avatar-cropper/u-avatar-cropper",
+			"style": {
+				"navigationBarTitleText": "图片裁剪",
+				"navigationBarBackgroundColor": "#000000"
+			}
+		}
+		
     ],
 	"globalStyle": {
 		"navigationStyle": "custom",

+ 1 - 5
pages/activityList/activity/authorBoost.vue

@@ -1,11 +1,7 @@
 <template>
 	<view>
 		<view v-if="boostDetail.cover"  class="bg-img" style="height: 563upx;" :style="{'backgroundImage':'url('+ boostDetail.cover +')'}"></view>
-		<view v-else class="flex justify-center align-center"  style="height: 563upx;background-color: #e5e5e5;">
-			<view class="text-white" >
-				
-			</view>
-		</view>
+		<view v-else class="bg-img"  style="height: 563upx;background-image: url('https://yyzs.nanyue6688.com/obsfile/ea1a9741a5d5469e967dac8e8e7f0c9d-singerBg.png');"></view>
 		<view class="homeBtn" @click="home">
 			<image src="/static/home.png" style="width: 40upx;height: 40upx;" />
 		</view>

+ 30 - 1
pages/activityList/activity/signUp.vue

@@ -15,7 +15,7 @@
 				</block>
 			</block>
 		</view>
-		<view class="image-container" @click="uploadCover" v-if="data.urlsType == 1">
+		<view class="image-container" @click="chooseAvatar" v-if="data.urlsType == 1">
 			<block v-if="$u.test.isEmpty(data.cover)">
 				<view class="cuIcon-roundaddfill theme-color" style="font-size: 80upx;padding: 100upx 0 30upx 0;"></view>
 				<view class="text-black text-bold text-sm">请上传作品封面</view>
@@ -101,6 +101,19 @@
 			this.data.activityId = options.activityId;
 			this.data.userId = uni.getStorageSync("userId");
 		},
+		created() {
+			uni.$on('uAvatarCropper', path => {
+				// 可以在此上传到服务端
+				uni.uploadFile({
+					url: `https://yyzs.nanyue6688.com/ldt/api/putObject`, //仅为示例,非真实的接口地址
+					filePath: path,
+					name: 'file',
+					success: (uploadFileRes) => {
+						this.data.cover = JSON.parse(uploadFileRes.data).data;
+					}
+				});
+			})
+		},
 		methods: {
 			async upload(index) {
 				console.log(index);
@@ -141,6 +154,22 @@
 				this.current = index;
 				this.data.personType = item;
 			},
+			chooseAvatar() {
+				// 此为uView的跳转方法,详见"文档-JS"部分,也可以用uni的uni.navigateTo
+				this.$u.route({
+					// 关于此路径,请见下方"注意事项"
+					url: '/uview-ui/components/u-avatar-cropper/u-avatar-cropper',
+					// 内部已设置以下默认参数值,可不传这些参数
+					params: {
+						// 输出图片宽度,高等于宽,单位px
+						destWidth: 300,
+						// 裁剪框宽度,高等于宽,单位px
+						rectWidth: 280,
+						// 输出的图片类型,如果'png'类型发现裁剪的图片太大,改成"jpg"即可
+						fileType: 'jpg',
+					}
+				})
+			},
 			navWithParam() {
 				console.log(this.data);
 				if (this.$u.test.isEmpty(this.data.userId)) {

+ 29 - 0
pages/activityList/mine/myMusic.vue

@@ -111,6 +111,19 @@
 				 this.fetchList()
 			}
 		 },
+		 created() {
+		 	uni.$on('uAvatarCropper', path => {
+		 		// 可以在此上传到服务端
+		 		uni.uploadFile({
+		 			url: `https://yyzs.nanyue6688.com/ldt/api/putObject`, //仅为示例,非真实的接口地址
+		 			filePath: path,
+		 			name: 'file',
+		 			success: (uploadFileRes) => {
+		 				this.data.cover = JSON.parse(uploadFileRes.data).data;
+		 			}
+		 		});
+		 	})
+		 },
 		methods: {
 			init(){
 				if (!this.userId) {
@@ -134,6 +147,22 @@
 					this.data=res
 				})
 			},
+			chooseAvatar() {
+				// 此为uView的跳转方法,详见"文档-JS"部分,也可以用uni的uni.navigateTo
+				this.$u.route({
+					// 关于此路径,请见下方"注意事项"
+					url: '/uview-ui/components/u-avatar-cropper/u-avatar-cropper',
+					// 内部已设置以下默认参数值,可不传这些参数
+					params: {
+						// 输出图片宽度,高等于宽,单位px
+						destWidth: 300,
+						// 裁剪框宽度,高等于宽,单位px
+						rectWidth: 280,
+						// 输出的图片类型,如果'png'类型发现裁剪的图片太大,改成"jpg"即可
+						fileType: 'jpg',
+					}
+				})
+			},
 			uploadCover() {
 				this.$mpi.uploadFile().then(res=>{
 					let obj = JSON.parse(res)