|
@@ -15,7 +15,7 @@
|
|
|
</block>
|
|
</block>
|
|
|
</block>
|
|
</block>
|
|
|
</view>
|
|
</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)">
|
|
<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="cuIcon-roundaddfill theme-color" style="font-size: 80upx;padding: 100upx 0 30upx 0;"></view>
|
|
|
<view class="text-black text-bold text-sm">请上传作品封面</view>
|
|
<view class="text-black text-bold text-sm">请上传作品封面</view>
|
|
@@ -101,6 +101,19 @@
|
|
|
this.data.activityId = options.activityId;
|
|
this.data.activityId = options.activityId;
|
|
|
this.data.userId = uni.getStorageSync("userId");
|
|
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: {
|
|
methods: {
|
|
|
async upload(index) {
|
|
async upload(index) {
|
|
|
console.log(index);
|
|
console.log(index);
|
|
@@ -141,6 +154,22 @@
|
|
|
this.current = index;
|
|
this.current = index;
|
|
|
this.data.personType = item;
|
|
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() {
|
|
navWithParam() {
|
|
|
console.log(this.data);
|
|
console.log(this.data);
|
|
|
if (this.$u.test.isEmpty(this.data.userId)) {
|
|
if (this.$u.test.isEmpty(this.data.userId)) {
|