uploadscript.vue 4.6 KB

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