uploaddata.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683
  1. <template>
  2. <view style="position: relative;">
  3. <!-- 胶囊 -->
  4. <mvBar :mysNavConfig="mysNavConfig"></mvBar>
  5. <view :style="{marginTop:navH}"></view>
  6. <view @click="toRecord()">
  7. <view style="display: flex;justify-content: center;">
  8. <image style="height: 60rpx;width: 60rpx;" src="../../static/img/icon-clock.png"></image>
  9. </view>
  10. <view style="display: flex;justify-content: center;">
  11. <p style="font-size: 30rpx;">查看修改/反馈记录</p>
  12. </view>
  13. </view>
  14. <view v-if="!loading && !onlyShow">
  15. <view style="margin: 40rpx 20rpx;">
  16. <uni-forms :modelValue="formData" validate-trigger="bind" err-show-type="undertext" label-width="150">
  17. <uni-forms-item name="play_number" label="小眼睛阅读数/播放量">
  18. <view class="number-inupt">
  19. <uni-easyinput type="number" v-model="playsCount" :inputBorder="false" placeholder="输入"
  20. style="width:200rpx" v-if="playsCountInfo === 1" @input="onInput1">
  21. </uni-easyinput>
  22. <uni-easyinput type="digit" v-model="playsCount" :inputBorder="false" placeholder="输入"
  23. style="width:200rpx" v-else @input="onInput2">
  24. </uni-easyinput>
  25. <picker @change="bindPickerChange1" :value="index" :range="Range" range-key="label"
  26. style="z-index: 999;background-color: #fcdf41;padding: 0 10rpx;border-radius: 5rpx;">
  27. <view>{{ playsLabel }}</view>
  28. </picker>
  29. </view>
  30. </uni-forms-item>
  31. <uni-forms-item name="like_number" label="点赞数">
  32. <view class="number-inupt">
  33. <uni-easyinput type="number" v-model="likesCount" :inputBorder="false" placeholder="输入"
  34. style="width:200rpx" v-if="likesCountInfo === 1" @input="onInput3">
  35. </uni-easyinput>
  36. <uni-easyinput type="digit" v-model="likesCount" :inputBorder="false" placeholder="输入"
  37. style="width:200rpx" v-else @input="onInput4">
  38. </uni-easyinput>
  39. <picker @change="bindPickerChange2" :value="index2" :range="Range" range-key="label"
  40. style="z-index: 999;background-color: #fcdf41;padding: 0 10rpx;border-radius: 5rpx;">
  41. <view>{{ likesLabel }}</view>
  42. </picker>
  43. </view>
  44. </uni-forms-item>
  45. <uni-forms-item name="collect_number" label="收藏数">
  46. <view class="number-inupt">
  47. <uni-easyinput type="number" v-model="collectsCount" :inputBorder="false" placeholder="输入"
  48. style="width:200rpx" v-if="collectsCountInfo === 1" @input="onInput5">
  49. </uni-easyinput>
  50. <uni-easyinput type="digit" v-model="collectsCount" :inputBorder="false" placeholder="输入"
  51. style="width:200rpx" v-else @input="onInput6">
  52. </uni-easyinput>
  53. <picker @change="bindPickerChange3" :value="index3" :range="Range" range-key="label"
  54. style="z-index: 999;background-color: #fcdf41;padding: 0 10rpx;border-radius: 5rpx;">
  55. <view>{{ collectsLabel }}</view>
  56. </picker>
  57. </view>
  58. </uni-forms-item>
  59. <uni-forms-item name="comment_number" label="评论数">
  60. <view class="number-inupt">
  61. <uni-easyinput type="number" v-model="commentsCount" :inputBorder="false" placeholder="输入"
  62. style="width:200rpx" v-if="commentsCountInfo === 1" @input="onInput7">
  63. </uni-easyinput>
  64. <uni-easyinput type="digit" v-model="commentsCount" :inputBorder="false" placeholder="输入"
  65. style="width:200rpx" v-else @input="onInput8">
  66. </uni-easyinput>
  67. <picker @change="bindPickerChange4" :value="index4" :range="Range" range-key="label"
  68. style="z-index: 999;background-color: #fcdf41;padding: 0 10rpx;border-radius: 5rpx;">
  69. <view>{{ commentsLabel }}</view>
  70. </picker>
  71. </view>
  72. </uni-forms-item>
  73. </uni-forms>
  74. </view>
  75. <view style="margin: 0 20rpx;">
  76. <p style="font-size: 14px;margin-bottom: 20rpx;">上传小眼睛阅读数/播放量截图</p>
  77. <htz-image-upload :max="1" mediaType="image" name="file" :chooseNum="1" v-model="imageData"
  78. @chooseSuccess="ceshiChooseSuccess1">
  79. </htz-image-upload>
  80. </view>
  81. <view class="signup">
  82. <button type="default" class="but1" :loading="loading" @click="submit()">
  83. 提交数据</button>
  84. </view>
  85. </view>
  86. <view v-if="!loading && onlyShow">
  87. <view style="margin: 20rpx;">
  88. <view style="display: flex;margin-bottom: 10rpx;">
  89. <view style="width: 400rpx;">小眼睛阅读数/播放量</view>
  90. <view style="border: 1rpx;">{{formData.show_play_number}}</view>
  91. </view>
  92. <view style="display: flex;margin-bottom: 10rpx;">
  93. <view style="width: 400rpx;">点赞数</view>
  94. <view style="border: 1rpx;">{{formData.show_like_number}}</view>
  95. </view>
  96. <view style="display: flex;margin-bottom: 10rpx;">
  97. <view style="width: 400rpx;">收藏数</view>
  98. <view style="border: 1rpx;">{{formData.show_collect_number}}</view>
  99. </view>
  100. <view style="display: flex;margin-bottom: 10rpx;">
  101. <view style="width: 400rpx;">评论数</view>
  102. <view style="border: 1rpx;">{{formData.show_comment_number}}</view>
  103. </view>
  104. <!-- 图片 -->
  105. <view style="margin-top: 10rpx;">
  106. <p>小眼睛阅读数/播放量截图</p>
  107. <image :src="imageData" mode="aspectFit"></image>
  108. </view>
  109. </view>
  110. </view>
  111. </view>
  112. </template>
  113. <script>
  114. import mvBar from "@/components/mys_navBar/mysNavBar";
  115. import htzImageUpload from '@/components/htz-image-upload/htz-image-upload.vue';
  116. import getPolicyEncode from '@/components/obs/getPolicy.js';
  117. import getSignature from '@/components/obs/GetSignature.js';
  118. import {
  119. fansview
  120. } from '@/components/utils.js';
  121. export default {
  122. components: {
  123. mvBar,
  124. htzImageUpload,
  125. },
  126. data() {
  127. return {
  128. hasClicked1: false,
  129. hasClicked2: false,
  130. hasClicked3: false,
  131. hasClicked4: false,
  132. onlyShow: false,
  133. loading: true,
  134. navH: getApp().globalData.navHeight,
  135. taskId: "",
  136. dataStatus: "",
  137. imageData: [],
  138. formData: {
  139. play_number: "",
  140. like_number: "",
  141. collect_number: "",
  142. commet_number: "",
  143. show_play_number: "",
  144. show_like_number: "",
  145. show_collect_number: "",
  146. show_commet_number: "",
  147. },
  148. index1: 0,
  149. playsLabel: "选择单位",
  150. playsCount: null,
  151. playsCountInfo: 1,
  152. index2: 0,
  153. likesLabel: "选择单位",
  154. likesCount: null,
  155. likesCountInfo: 1,
  156. index3: 0,
  157. collectsLabel: "选择单位",
  158. collectsCount: null,
  159. collectsCountInfo: 1,
  160. index4: 0,
  161. commentsLabel: "选择单位",
  162. commentsCount: null,
  163. commentsCountInfo: 1,
  164. Range: [{
  165. value: 1,
  166. label: '个'
  167. },
  168. {
  169. value: 10000,
  170. label: '万'
  171. },
  172. {
  173. value: 100000000,
  174. label: '亿'
  175. }
  176. ],
  177. // rules: {
  178. // // 对play_number字段进行必填验证
  179. // play_number: {
  180. // rules: [{
  181. // required: true,
  182. // errorMessage: '10位以内的数字',
  183. // },
  184. // {
  185. // minLength: 1,
  186. // maxLength: 10,
  187. // errorMessage: '10位以内的数字',
  188. // }
  189. // ]
  190. // },
  191. // // 对like_number字段进行必填验证
  192. // like_number: {
  193. // rules: [{
  194. // required: true,
  195. // errorMessage: '10位以内的数字',
  196. // },
  197. // {
  198. // minLength: 1,
  199. // maxLength: 10,
  200. // errorMessage: '10位以内的数字',
  201. // }
  202. // ]
  203. // },
  204. // // 对collect_number字段进行必填验证
  205. // collect_number: {
  206. // rules: [{
  207. // required: true,
  208. // errorMessage: '10位以内的数字',
  209. // },
  210. // {
  211. // minLength: 1,
  212. // maxLength: 10,
  213. // errorMessage: '10位以内的数字',
  214. // }
  215. // ]
  216. // },
  217. // // 对comment_number字段进行必填验证
  218. // comment_number: {
  219. // rules: [{
  220. // required: true,
  221. // errorMessage: '10位以内的数字',
  222. // },
  223. // {
  224. // minLength: 1,
  225. // maxLength: 10,
  226. // errorMessage: '10位以内的数字',
  227. // }
  228. // ]
  229. // }
  230. // },
  231. mysNavConfig: {
  232. /* 开启单页显示首页图标 */
  233. isHome: true,
  234. /* 固定导航 */
  235. navFixed: true,
  236. /* 标题 (屏幕中心居中 两边图标中心居中使用slot center1) */
  237. navTitle: {
  238. text: "上传数据",
  239. color: "",
  240. fontSize: "32rpx", // px upx rpx
  241. fontWeight: "normal", // 100 - 700
  242. },
  243. btnType: "type2",
  244. onLeftClick: '',
  245. /* type2 按钮 */
  246. type2Config: {
  247. // 左图标
  248. leftPath: "/static/img/png2.png",
  249. // 右图标
  250. rightPath: "/static/img/png4.png",
  251. // 圆角
  252. radius: "40rpx",
  253. },
  254. },
  255. }
  256. },
  257. onLoad(options) {
  258. let data = options.textObj.replace(/""/g, "");
  259. data = JSON.parse(decodeURIComponent(data))
  260. this.taskId = data.taskId
  261. this.dataStatus = data.dataStatus
  262. this.getData()
  263. },
  264. methods: {
  265. async getData() {
  266. this.loading = true
  267. uni.showLoading({
  268. title: '加载中'
  269. });
  270. await this.$https.get('/youngee/c/t/g/get-unsubmit-task-data' +
  271. "?" +
  272. "task_id" +
  273. "=" +
  274. this.taskId)
  275. .then(res => {
  276. console.log(res)
  277. if (res.data.data != null) {
  278. this.onlyShow = true
  279. this.formData.play_number = res.data.data.play_number
  280. this.formData.like_number = res.data.data.like_number
  281. this.formData.collect_number = res.data.data.collect_number
  282. this.formData.comment_number = res.data.data.comment_number
  283. this.formData.show_play_number = fansview(this.formData.play_number)
  284. this.formData.show_like_number = fansview(this.formData.like_number)
  285. this.formData.show_collect_number = fansview(this.formData.collect_number)
  286. this.formData.show_comment_number = fansview(this.formData.comment_number)
  287. this.imageData.push(res.data.data.photo_url)
  288. }
  289. })
  290. uni.hideLoading();
  291. this.loading = false
  292. },
  293. toRecord() {
  294. var data = {
  295. taskId: this.taskId,
  296. };
  297. data = JSON.stringify(data)
  298. uni.navigateTo({
  299. url: '/pages/workspace/datarecord?textObj=' + encodeURIComponent(data)
  300. });
  301. },
  302. submit() {
  303. // 校验
  304. if (this.playsCount == null || this.playsCount * this.playsCountInfo < 0 || this.playsLabel == "选择单位") {
  305. uni.showToast({
  306. title: '请输入正确播放量',
  307. icon: 'none'
  308. })
  309. return
  310. }
  311. this.formData.play_number = this.playsCount * this.playsCountInfo
  312. if (this.likesCount == null || this.likesCount * this.likesCountInfo < 0 || this.likesLabel == "选择单位") {
  313. uni.showToast({
  314. title: '请输入正确点赞数',
  315. icon: 'none'
  316. })
  317. return
  318. }
  319. this.formData.like_number = this.likesCount * this.likesCountInfo
  320. if (this.collectsCount == null || this.collectsCount * this.collectsCountInfo < 0 || this.collectsLabel == "选择单位") {
  321. uni.showToast({
  322. title: '请输入正确收藏数',
  323. icon: 'none'
  324. })
  325. return
  326. }
  327. this.formData.collect_number = this.collectsCount * this.collectsCountInfo
  328. if (this.commentsCount == null || this.commentsCount * this.commentsCountInfo < 0 || this.commentsLabel == "选择单位") {
  329. uni.showToast({
  330. title: '请输入正确评论数',
  331. icon: 'none'
  332. })
  333. return
  334. }
  335. this.formData.comment_number = this.commentsCount * this.commentsCountInfo
  336. if (this.imageData.length == 0) {
  337. uni.showToast({
  338. title: "请上传正确的截图",
  339. icon: 'none'
  340. })
  341. return
  342. }
  343. let that = this
  344. uni.showModal({
  345. title: '提示',
  346. content: '提交后无法修改并进行审核,确认提交?',
  347. success: async function(res) {
  348. if (res.confirm) {
  349. // 调用添加数据接口
  350. await that.$https.post('/youngee/c/t/p/add-task-data', {
  351. task_id: that.taskId,
  352. play_number: that.formData.play_number,
  353. like_number: that.formData.like_number,
  354. collect_number: that.formData.collect_number,
  355. comment_number: that.formData.comment_number,
  356. photo_url: that.imageData[0],
  357. })
  358. .then(res => {
  359. console.log(res)
  360. })
  361. await that.$https.get('/youngee/c/t/g/submit-task-data' +
  362. "?" +
  363. "task_id" +
  364. "=" +
  365. that.taskId)
  366. .then(res => {
  367. console.log(res)
  368. })
  369. uni.navigateBack()
  370. } else if (res.cancel) {
  371. console.log('用户点击取消');
  372. }
  373. }
  374. });
  375. },
  376. ceshiChooseSuccess1(tempFilePaths, e) { //选择图片返回
  377. console.log('ceshiChooseSuccess', tempFilePaths, e);
  378. if (e == 0) {
  379. this.store = 'talent_upload/' + this.guid() + '.png'
  380. } else if (e == 1) {
  381. this.store = 'talent_upload/' + this.guid() + '.mp4'
  382. }
  383. /****************
  384. 以下代码是自定义上传逻辑,仅供参考
  385. ***************/
  386. this.imgUpload1(tempFilePaths);
  387. /*******************************/
  388. console.log("imgdata" + this.imageData)
  389. },
  390. imgUpload1(tempFilePaths) {
  391. let that = this
  392. console.log('imgUpload', tempFilePaths)
  393. let config = {
  394. AccessKeyId: 'IVW21DTGIIUBBAGXKK0Y', //AK
  395. SecretKey: 'Y01nEQNcLOATMw7uJwrk3yOdQZ2fqLhSnXcOKVDE', //SK
  396. EndPoint: 'https://horastar.obs.cn-east-3.myhuaweicloud.com', //上传文件的路径
  397. };
  398. let fileName = this.store; //指定上传到OBS桶中的对象名
  399. // let fileName = "talent_upload/icon-arrow-right.png"
  400. let OBSPolicy = { //设定policy内容
  401. "expiration": "2089-12-31T12:00:00.000Z",
  402. "conditions": [{
  403. "bucket": "horastar"
  404. }, //Bucket name
  405. // {"bucket": "goin"},
  406. {
  407. 'key': fileName
  408. }
  409. ]
  410. }
  411. let policyEncoded = getPolicyEncode(OBSPolicy); //计算policy编码值
  412. let signature = getSignature(policyEncoded, config.SecretKey); //计算signature
  413. uni.uploadFile({
  414. //url: config.EndPoint,
  415. url: config.EndPoint,
  416. filePath: tempFilePaths[0],
  417. name: 'file',
  418. formData: {
  419. 'AccessKeyID': config.AccessKeyId,
  420. 'policy': policyEncoded,
  421. 'signature': signature,
  422. 'key': fileName,
  423. },
  424. success: function(res) {
  425. console.log(res.statusCode); //打印响应状态码
  426. if (res.statusCode == '204') {
  427. that.imageData.push(config.EndPoint + '/' + fileName);
  428. console.log('上传图片成功', res)
  429. let obs_url = config.EndPoint + '/' + fileName; //用你自己的 bucket 名替换星号
  430. console.log(obs_url)
  431. // that.formData.home_img = obs_url
  432. uni.showToast({
  433. title: '上传成功',
  434. icon: '成功'
  435. });
  436. } else {
  437. console.log('上传图片失败', res)
  438. uni.showToast({
  439. title: '上传失败',
  440. icon: '失败'
  441. });
  442. }
  443. },
  444. fail: function(e) {
  445. console.log(e);
  446. uni.showToast({
  447. title: '上传失败22222',
  448. icon: '失败'
  449. });
  450. }
  451. })
  452. },
  453. guid() {
  454. return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
  455. var r = Math.random() * 16 | 0,
  456. v = c == 'x' ? r : (r & 0x3 | 0x8);
  457. return v.toString(16);
  458. });
  459. },
  460. // 量级选择
  461. bindPickerChange1: function(e) {
  462. if (this.index1 !== e.detail.value) {
  463. this.playsCount = null
  464. }
  465. this.index1 = e.detail.value;
  466. this.playsLabel = this.Range[this.index1].label
  467. this.playsCountInfo = this.Range[this.index1].value
  468. console.log(this.playsCountInfo, this.playsLabel)
  469. },
  470. // 量级选择
  471. bindPickerChange2: function(e) {
  472. if (this.index2 !== e.detail.value) {
  473. this.likesCount = null
  474. }
  475. this.index2 = e.detail.value;
  476. this.likesLabel = this.Range[this.index2].label
  477. this.likesCountInfo = this.Range[this.index2].value
  478. console.log(this.likesCountInfo, this.likesLabel)
  479. },
  480. // 量级选择
  481. bindPickerChange3: function(e) {
  482. if (this.index3 !== e.detail.value) {
  483. this.collectsCount = null
  484. }
  485. this.index3 = e.detail.value;
  486. this.collectsLabel = this.Range[this.index3].label
  487. this.collectsCountInfo = this.Range[this.index3].value
  488. console.log(this.collectsCountInfo, this.collectsLabel)
  489. },
  490. // 量级选择
  491. bindPickerChange4: function(e) {
  492. if (this.index4 !== e.detail.value) {
  493. this.commentsCount = null
  494. }
  495. this.index4 = e.detail.value;
  496. this.commentsLabel = this.Range[this.index4].label
  497. this.commentsCountInfo = this.Range[this.index4].value
  498. console.log(this.commentsCountInfo, this.commentsLabel)
  499. },
  500. onInput1(e) {
  501. // 验证是否是纯数字
  502. const isNumber = /^\d*$/.test(e)
  503. // 过滤非数字
  504. e = e.replace(/\D/g, '')
  505. if (!isNumber || e < 0 || e > 9999) {
  506. uni.showToast({
  507. title: '请输入[0,9999]区间的整数',
  508. icon: 'none'
  509. })
  510. console.log('请输入[0,9999]区间的整数')
  511. }
  512. this.$nextTick(() => {
  513. this.playsCount = (e >= 0 && e <= 9999 && e.match(/^\d*/g)[0]) ? e : null
  514. })
  515. },
  516. onInput2(e) {
  517. console.log(e)
  518. e = (e.match(/^\d*(\.?\d{0,1})/g)[0]) || null
  519. // //重新赋值给input
  520. if (e < 0 || e > 9999.9) {
  521. uni.showToast({
  522. title: '请输入[1,9999.9]区间内的数',
  523. icon: 'none'
  524. })
  525. console.log('请输入[1,9999.9]区间内的数')
  526. }
  527. this.$nextTick(() => {
  528. this.playsCount = (e > 0 && e <= 9999.9) ? e : null
  529. })
  530. },
  531. onInput3(e) {
  532. // 验证是否是纯数字
  533. const isNumber = /^\d*$/.test(e)
  534. // 过滤非数字
  535. e = e.replace(/\D/g, '')
  536. if (!isNumber || e < 0 || e > 9999) {
  537. uni.showToast({
  538. title: '请输入[0,9999]区间的整数',
  539. icon: 'none'
  540. })
  541. console.log('请输入[0,9999]区间的整数')
  542. }
  543. this.$nextTick(() => {
  544. this.likesCount = (e >= 0 && e <= 9999 && e.match(/^\d*/g)[0]) ? e : null
  545. })
  546. },
  547. onInput4(e) {
  548. console.log(e)
  549. e = (e.match(/^\d*(\.?\d{0,1})/g)[0]) || null
  550. // //重新赋值给input
  551. if (e < 0 || e > 9999.9) {
  552. uni.showToast({
  553. title: '请输入[1,9999.9]区间内的数',
  554. icon: 'none'
  555. })
  556. console.log('请输入[1,9999.9]区间内的数')
  557. }
  558. this.$nextTick(() => {
  559. this.likesCount = (e > 0 && e <= 9999.9) ? e : null
  560. })
  561. },
  562. onInput5(e) {
  563. // 验证是否是纯数字
  564. const isNumber = /^\d*$/.test(e)
  565. // 过滤非数字
  566. e = e.replace(/\D/g, '')
  567. if (!isNumber || e < 0 || e > 9999) {
  568. uni.showToast({
  569. title: '请输入[0,9999]区间的整数',
  570. icon: 'none'
  571. })
  572. console.log('请输入[0,9999]区间的整数')
  573. }
  574. this.$nextTick(() => {
  575. this.collectsCount = (e >= 0 && e <= 9999 && e.match(/^\d*/g)[0]) ? e : null
  576. })
  577. },
  578. onInput6(e) {
  579. console.log(e)
  580. e = (e.match(/^\d*(\.?\d{0,1})/g)[0]) || null
  581. // //重新赋值给input
  582. if (e < 0 || e > 9999.9) {
  583. uni.showToast({
  584. title: '请输入[1,9999.9]区间内的数',
  585. icon: 'none'
  586. })
  587. console.log('请输入[1,9999.9]区间内的数')
  588. }
  589. this.$nextTick(() => {
  590. this.collectsCount = (e > 0 && e <= 9999.9) ? e : null
  591. })
  592. },
  593. onInput7(e) {
  594. // 验证是否是纯数字
  595. const isNumber = /^\d*$/.test(e)
  596. // 过滤非数字
  597. e = e.replace(/\D/g, '')
  598. if (!isNumber || e < 0 || e > 9999) {
  599. uni.showToast({
  600. title: '请输入[0,9999]区间的整数',
  601. icon: 'none'
  602. })
  603. console.log('请输入[0,9999]区间的整数')
  604. }
  605. this.$nextTick(() => {
  606. this.commentsCount = (e >= 0 && e <= 9999 && e.match(/^\d*/g)[0]) ? e : null
  607. })
  608. },
  609. onInput8(e) {
  610. console.log(e)
  611. e = (e.match(/^\d*(\.?\d{0,1})/g)[0]) || null
  612. // //重新赋值给input
  613. if (e < 0 || e > 9999.9) {
  614. uni.showToast({
  615. title: '请输入[1,9999.9]区间内的数',
  616. icon: 'none'
  617. })
  618. console.log('请输入[1,9999.9]区间内的数')
  619. }
  620. this.$nextTick(() => {
  621. this.commentsCount = (e > 0 && e <= 9999.9) ? e : null
  622. })
  623. }
  624. }
  625. }
  626. </script>
  627. <style>
  628. /deep/ .uni-forms-item__content {
  629. display: flex !important;
  630. align-items: center !important;
  631. /* justify-content: space-between; */
  632. }
  633. </style>
  634. <style lang="scss" scoped>
  635. .signup {
  636. box-shadow: 0rpx 5rpx 40rpx #ccc;
  637. width: 100%;
  638. position: fixed;
  639. bottom: 0rpx;
  640. display: flex;
  641. height: 90rpx;
  642. padding-top: 2%;
  643. background-color: #FFFFFF;
  644. }
  645. .but1 {
  646. width: 60%;
  647. background-color: #f2d22d;
  648. border-radius: 20rpx;
  649. font-size: 36rpx;
  650. line-height: 200%;
  651. letter-spacing: 10rpx;
  652. font-weight: 500;
  653. height: 80%;
  654. &.on {
  655. background-color: #C0C0C0;
  656. }
  657. }
  658. .number-inupt {
  659. display: flex !important;
  660. align-items: center !important;
  661. }
  662. </style>