uploadscript.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  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. <!-- 多行输入框 -->
  16. <view style="padding: 20rpx 30rpx 0;">
  17. <uni-easyinput type="text" :inputBorder="false" v-model="title" placeholder="在此填写让人眼前一亮的标题吧"
  18. :placeholderStyle="placeholderStyle">
  19. </uni-easyinput>
  20. </view>
  21. <view style="padding: 40rpx 30rpx 150rpx;font-size: 30rpx;">
  22. <textarea v-model="text" maxlength="5000" auto-height="true" placeholder="添加正文(任务未要求可不填写进行提交)" />
  23. </view>
  24. <view class="signup">
  25. <button type="default" class="but1" :loading="loading" @click="submit()">
  26. 提交脚本</button>
  27. </view>
  28. </view>
  29. <view v-if="onlyShow" style="width: 100%;">
  30. <p style="font-size: 30rpx;padding: 20rpx 30rpx 0 ;">{{title}}</p>
  31. <view style="padding: 40rpx 30rpx 150rpx;font-size: 30rpx;">
  32. <text> {{text}}</text>
  33. </view>
  34. </view>
  35. </view>
  36. </template>
  37. <script>
  38. import mvBar from "@/components/mys_navBar/mysNavBar";
  39. export default {
  40. components: {
  41. mvBar,
  42. },
  43. data() {
  44. return {
  45. onlyShow: false,
  46. loading: true,
  47. placeholderStyle: "font-size: 30rpx;",
  48. navH: getApp().globalData.navHeight,
  49. taskId: "",
  50. title: "",
  51. text: "",
  52. scriptStatus: "",
  53. mysNavConfig: {
  54. /* 开启单页显示首页图标 */
  55. isHome: true,
  56. /* 固定导航 */
  57. navFixed: true,
  58. /* 标题 (屏幕中心居中 两边图标中心居中使用slot center1) */
  59. navTitle: {
  60. text: "上传脚本",
  61. color: "",
  62. fontSize: "32rpx", // px upx rpx
  63. fontWeight: "normal", // 100 - 700
  64. },
  65. btnType: "type2",
  66. onLeftClick: '',
  67. /* type2 按钮 */
  68. type2Config: {
  69. // 左图标
  70. leftPath: "/static/img/png2.png",
  71. // 右图标
  72. rightPath: "/static/img/png4.png",
  73. // 圆角
  74. radius: "40rpx",
  75. },
  76. },
  77. }
  78. },
  79. onLoad(options) {
  80. let data = options.textObj.replace(/""/g, "");
  81. data = JSON.parse(decodeURIComponent(data))
  82. this.taskId = data.taskId
  83. this.scriptStatus = data.scriptStatus
  84. this.getScript()
  85. },
  86. methods: {
  87. async getScript() {
  88. this.loading = true
  89. uni.showLoading({
  90. title: '加载中'
  91. });
  92. await this.$https.get('/youngee/c/t/g/get-unsubmit-task-script' +
  93. "?" +
  94. "task_id" +
  95. "=" +
  96. this.taskId)
  97. .then(res => {
  98. console.log(res)
  99. if (res.data.data != null) {
  100. this.onlyShow = true
  101. this.text = res.data.data.content
  102. this.title = res.data.data.title
  103. }
  104. })
  105. uni.hideLoading();
  106. this.loading = false
  107. },
  108. toRecord() {
  109. var data = {
  110. taskId: this.taskId,
  111. };
  112. data = JSON.stringify(data)
  113. uni.navigateTo({
  114. url: '/pages/workspace/scriptrecord?textObj=' + encodeURIComponent(data)
  115. });
  116. },
  117. async submit() {
  118. // 检验标题和内容是否为空
  119. // if (this.title == '') {
  120. // uni.showToast({
  121. // title: "请填写脚本标题",
  122. // icon: 'none'
  123. // })
  124. // return
  125. // }
  126. // if (this.text == '') {
  127. // uni.showToast({
  128. // title: "请填写脚本内容",
  129. // icon: 'none'
  130. // })
  131. // return
  132. // }
  133. let that = this
  134. uni.showModal({
  135. title: '提示',
  136. content: '提交后无法修改并进行审核,确认提交?',
  137. success: async function(res) {
  138. if (res.confirm) {
  139. await that.$https.post('/youngee/c/t/p/add-task-script', {
  140. task_id: that.taskId,
  141. title: that.title,
  142. content: that.text,
  143. })
  144. .then(res => {
  145. console.log(res)
  146. })
  147. await that.$https.get('/youngee/c/t/g/submit-task-script' +
  148. "?" +
  149. "task_id" +
  150. "=" +
  151. that.taskId)
  152. .then(res => {
  153. console.log(res)
  154. })
  155. uni.navigateBack()
  156. } else if (res.cancel) {
  157. console.log('用户点击取消');
  158. }
  159. }
  160. });
  161. },
  162. }
  163. }
  164. </script>
  165. <style>
  166. /deep/ .uni-easyinput__content-input {
  167. font-size: 30rpx !important;
  168. padding: 0 !important;
  169. }
  170. </style>
  171. <style lang="scss" scoped>
  172. .signup {
  173. box-shadow: 0rpx 5rpx 40rpx #ccc;
  174. width: 100%;
  175. position: fixed;
  176. bottom: 0rpx;
  177. display: flex;
  178. height: 90rpx;
  179. padding-top: 2%;
  180. background-color: #FFFFFF;
  181. z-index: 100;
  182. }
  183. .but1 {
  184. width: 60%;
  185. background-color: #f2d22d;
  186. border-radius: 20rpx;
  187. font-size: 36rpx;
  188. line-height: 200%;
  189. letter-spacing: 10rpx;
  190. font-weight: 500;
  191. height: 80%;
  192. &.on {
  193. background-color: #C0C0C0;
  194. }
  195. }
  196. </style>