|
@@ -15,24 +15,44 @@
|
|
|
<view style="margin: 40rpx;">
|
|
|
<uni-forms :modelValue="formData" validate-trigger="bind" err-show-type="undertext" label-width="150">
|
|
|
<uni-forms-item name="play_number" label="小眼睛阅读数/播放量">
|
|
|
- <uni-easyinput type="digit" maxlength=10 :inputBorder="false" v-model="formData.play_number"
|
|
|
- placeholder="输入">
|
|
|
+ <uni-easyinput type="number" v-model="playsCount" :inputBorder="false" placeholder="输入"
|
|
|
+ v-if="playsCountInfo === 1" @input="onInput1">
|
|
|
</uni-easyinput>
|
|
|
+ <uni-easyinput type="digit" v-model="playsCount" :inputBorder="false" placeholder="输入" v-else @input="onInput2">
|
|
|
+ </uni-easyinput>
|
|
|
+ <picker @change="bindPickerChange1" :value="index" :range="Range" range-key="label">
|
|
|
+ <view>{{ playsLabel }}</view>
|
|
|
+ </picker>
|
|
|
</uni-forms-item>
|
|
|
<uni-forms-item name="like_number" label="点赞数">
|
|
|
- <uni-easyinput type="digit" maxlength=10 :inputBorder="false" v-model="formData.like_number"
|
|
|
- placeholder="输入">
|
|
|
+ <uni-easyinput type="number" v-model="likesCount" :inputBorder="false" placeholder="输入"
|
|
|
+ v-if="likesCountInfo === 1" @input="onInput3">
|
|
|
+ </uni-easyinput>
|
|
|
+ <uni-easyinput type="digit" v-model="likesCount" :inputBorder="false" placeholder="输入" v-else @input="onInput4">
|
|
|
</uni-easyinput>
|
|
|
+ <picker @change="bindPickerChange2" :value="index2" :range="Range" range-key="label">
|
|
|
+ <view>{{ likesLabel }}</view>
|
|
|
+ </picker>
|
|
|
</uni-forms-item>
|
|
|
<uni-forms-item name="collect_number" label="收藏数">
|
|
|
- <uni-easyinput type="digit" maxlength=10 :inputBorder="false" v-model="formData.collect_number"
|
|
|
- placeholder="输入">
|
|
|
+ <uni-easyinput type="number" v-model="collectsCount" :inputBorder="false" placeholder="输入"
|
|
|
+ v-if="collectsCountInfo === 1" @input="onInput5">
|
|
|
</uni-easyinput>
|
|
|
+ <uni-easyinput type="digit" v-model="collectsCount" :inputBorder="false" placeholder="输入" v-else @input="onInput6">
|
|
|
+ </uni-easyinput>
|
|
|
+ <picker @change="bindPickerChange3" :value="index3" :range="Range" range-key="label">
|
|
|
+ <view>{{ collectsLabel }}</view>
|
|
|
+ </picker>
|
|
|
</uni-forms-item>
|
|
|
<uni-forms-item name="comment_number" label="评论数">
|
|
|
- <uni-easyinput type="digit" maxlength=10 :inputBorder="false" v-model="formData.comment_number"
|
|
|
- placeholder="输入">
|
|
|
+ <uni-easyinput type="number" v-model="commentsCount" :inputBorder="false" placeholder="输入"
|
|
|
+ v-if="commentsCountInfo === 1" @input="onInput7">
|
|
|
+ </uni-easyinput>
|
|
|
+ <uni-easyinput type="digit" v-model="commentsCount" :inputBorder="false" placeholder="输入" v-else @input="onInput8">
|
|
|
</uni-easyinput>
|
|
|
+ <picker @change="bindPickerChange4" :value="index4" :range="Range" range-key="label">
|
|
|
+ <view>{{ commentsLabel }}</view>
|
|
|
+ </picker>
|
|
|
</uni-forms-item>
|
|
|
</uni-forms>
|
|
|
</view>
|
|
@@ -54,19 +74,19 @@
|
|
|
<view style="margin: 20rpx;">
|
|
|
<view style="display: flex;margin-bottom: 10rpx;">
|
|
|
<view style="width: 400rpx;">小眼睛阅读数/播放量</view>
|
|
|
- <view style="width: 100rpx;border: 1rpx;">{{formData.show_play_number}}</view>
|
|
|
+ <view style="border: 1rpx;">{{formData.show_play_number}}</view>
|
|
|
</view>
|
|
|
<view style="display: flex;margin-bottom: 10rpx;">
|
|
|
<view style="width: 400rpx;">点赞数</view>
|
|
|
- <view style="width: 100rpx;border: 1rpx;">{{formData.show_like_number}}</view>
|
|
|
+ <view style="border: 1rpx;">{{formData.show_like_number}}</view>
|
|
|
</view>
|
|
|
<view style="display: flex;margin-bottom: 10rpx;">
|
|
|
<view style="width: 400rpx;">收藏数</view>
|
|
|
- <view style="width: 100rpx;border: 1rpx;">{{formData.show_collect_number}}</view>
|
|
|
+ <view style="border: 1rpx;">{{formData.show_collect_number}}</view>
|
|
|
</view>
|
|
|
<view style="display: flex;margin-bottom: 10rpx;">
|
|
|
<view style="width: 400rpx;">评论数</view>
|
|
|
- <view style="width: 100rpx;border: 1rpx;">{{formData.show_comment_number}}</view>
|
|
|
+ <view style="border: 1rpx;">{{formData.show_comment_number}}</view>
|
|
|
</view>
|
|
|
<!-- 图片 -->
|
|
|
|
|
@@ -110,6 +130,39 @@
|
|
|
show_collect_number: "",
|
|
|
show_commet_number: "",
|
|
|
},
|
|
|
+
|
|
|
+ index1: 0,
|
|
|
+ playsLabel: "个",
|
|
|
+ playsCount: 0,
|
|
|
+ playsCountInfo: 1,
|
|
|
+ index2: 0,
|
|
|
+ likesLabel: "个",
|
|
|
+ likesCount: 0,
|
|
|
+ likesCountInfo: 1,
|
|
|
+ index3: 0,
|
|
|
+ collectsLabel: "个",
|
|
|
+ collectsCount: 0,
|
|
|
+ collectsCountInfo: 1,
|
|
|
+ index4: 0,
|
|
|
+ commentsLabel: "个",
|
|
|
+ commentsCount: 0,
|
|
|
+ commentsCountInfo: 1,
|
|
|
+ Range: [{
|
|
|
+ value: 1,
|
|
|
+ label: '个'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ value: 10000,
|
|
|
+ label: '万'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ value: 100000000,
|
|
|
+ label: '亿'
|
|
|
+ }
|
|
|
+ ],
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
// rules: {
|
|
|
// // 对play_number字段进行必填验证
|
|
|
// play_number: {
|
|
@@ -239,10 +292,34 @@
|
|
|
|
|
|
submit() {
|
|
|
// 校验
|
|
|
- if (this.formData.play_number == "" || this.formData.like_number == "" || this.formData.collect_number ==
|
|
|
- "" || this.formData.comment_number == "") {
|
|
|
+ this.formData.play_number = this.playsCount * this.playsCountInfo
|
|
|
+ if (parseInt(this.formData.plays_count) === 0) {
|
|
|
uni.showToast({
|
|
|
- title: '请输入10位以内的数字',
|
|
|
+ title: '请输入正确数量',
|
|
|
+ icon: 'none'
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.formData.like_number = this.likesCount * this.likesCountInfo
|
|
|
+ if (parseInt(this.formData.likes_count) === 0) {
|
|
|
+ uni.showToast({
|
|
|
+ title: '请输入正确数量',
|
|
|
+ icon: 'none'
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.formData.collect_number = this.collectsCount * this.collectsCountInfo
|
|
|
+ if (parseInt(this.formData.collects_count) === 0) {
|
|
|
+ uni.showToast({
|
|
|
+ title: '请输入正确数量',
|
|
|
+ icon: 'none'
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.formData.comment_number = this.commentsCount * this.commentsCountInfo
|
|
|
+ if (parseInt(this.formData.comments_count) === 0) {
|
|
|
+ uni.showToast({
|
|
|
+ title: '请输入正确数量',
|
|
|
icon: 'none'
|
|
|
})
|
|
|
return
|
|
@@ -376,10 +453,112 @@
|
|
|
return v.toString(16);
|
|
|
});
|
|
|
},
|
|
|
+ // 量级选择
|
|
|
+ bindPickerChange1: function(e) {
|
|
|
+ this.index1 = e.detail.value;
|
|
|
+ this.playsLabel = this.Range[this.index1].label
|
|
|
+ this.playsCountInfo = this.Range[this.index1].value
|
|
|
+ console.log(this.playsCountInfo, this.playsLabel)
|
|
|
+ },
|
|
|
+ // 量级选择
|
|
|
+ bindPickerChange2: function(e) {
|
|
|
+ this.index2 = e.detail.value;
|
|
|
+ this.likesLabel = this.Range[this.index2].label
|
|
|
+ this.likesCountInfo = this.Range[this.index2].value
|
|
|
+ console.log(this.likesCountInfo, this.likesLabel)
|
|
|
+ },
|
|
|
+ // 量级选择
|
|
|
+ bindPickerChange3: function(e) {
|
|
|
+ this.index3 = e.detail.value;
|
|
|
+ this.collectsLabel = this.Range[this.index3].label
|
|
|
+ this.collectsCountInfo = this.Range[this.index3].value
|
|
|
+ console.log(this.collectsCountInfo, this.collectsLabel)
|
|
|
+ },
|
|
|
+ // 量级选择
|
|
|
+ bindPickerChange4: function(e) {
|
|
|
+ this.index4 = e.detail.value;
|
|
|
+ this.commentsLabel = this.Range[this.index4].label
|
|
|
+ this.commentsCountInfo = this.Range[this.index4].value
|
|
|
+ console.log(this.commentsCountInfo, this.commentsLabel)
|
|
|
+ },
|
|
|
+ onInput1(e) {
|
|
|
+ console.log(e)
|
|
|
+ e = e.replace(/\D/g, '')
|
|
|
+ // e = (e.match(/^\d*(\.?\d{0,1})/g)[0]) || null
|
|
|
+ // //重新赋值给input
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.playsCount = e
|
|
|
+ })
|
|
|
+ },
|
|
|
+ onInput2(e) {
|
|
|
+ console.log(e)
|
|
|
+ e = (e.match(/^\d*(\.?\d{0,1})/g)[0]) || null
|
|
|
+ // //重新赋值给input
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.playsCount = e
|
|
|
+ })
|
|
|
+ },
|
|
|
+ onInput3(e) {
|
|
|
+ console.log(e)
|
|
|
+ e = e.replace(/\D/g, '')
|
|
|
+ // e = (e.match(/^\d*(\.?\d{0,1})/g)[0]) || null
|
|
|
+ // //重新赋值给input
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.likesCount = e
|
|
|
+ })
|
|
|
+ },
|
|
|
+ onInput4(e) {
|
|
|
+ console.log(e)
|
|
|
+ e = (e.match(/^\d*(\.?\d{0,1})/g)[0]) || null
|
|
|
+ // //重新赋值给input
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.likesCount = e
|
|
|
+ })
|
|
|
+ },
|
|
|
+ onInput5(e) {
|
|
|
+ console.log(e)
|
|
|
+ e = e.replace(/\D/g, '')
|
|
|
+ // e = (e.match(/^\d*(\.?\d{0,1})/g)[0]) || null
|
|
|
+ // //重新赋值给input
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.collectsCount = e
|
|
|
+ })
|
|
|
+ },
|
|
|
+ onInput6(e) {
|
|
|
+ console.log(e)
|
|
|
+ e = (e.match(/^\d*(\.?\d{0,1})/g)[0]) || null
|
|
|
+ // //重新赋值给input
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.collectsCount = e
|
|
|
+ })
|
|
|
+ },
|
|
|
+ onInput7(e) {
|
|
|
+ console.log(e)
|
|
|
+ e = e.replace(/\D/g, '')
|
|
|
+ // e = (e.match(/^\d*(\.?\d{0,1})/g)[0]) || null
|
|
|
+ // //重新赋值给input
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.commentsCount = e
|
|
|
+ })
|
|
|
+ },
|
|
|
+ onInput8(e) {
|
|
|
+ console.log(e)
|
|
|
+ e = (e.match(/^\d*(\.?\d{0,1})/g)[0]) || null
|
|
|
+ // //重新赋值给input
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.commentsCount = e
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
|
-
|
|
|
+<style>
|
|
|
+ /deep/ .uni-forms-item__content {
|
|
|
+ display: flex !important;
|
|
|
+ align-items: center !important;
|
|
|
+ justify-content: space-between;
|
|
|
+ }
|
|
|
+</style>
|
|
|
<style lang="scss" scoped>
|
|
|
.signup {
|
|
|
box-shadow: 0rpx 5rpx 40rpx #ccc;
|