configure.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. <template>
  2. <view class="configure-page">
  3. <view class="greyTitle">
  4. <text>为结果选项配置后续操作</text>
  5. <text class="recovery" @click="recoveryList">恢复初始配置</text>
  6. </view>
  7. <view class="configureCont">
  8. <view
  9. v-for="(item, index) in resultConfigList"
  10. :key="index"
  11. class="configure-cont"
  12. @click="changeIndex(index)"
  13. >
  14. <view class="contTitle">{{ item.name }}</view>
  15. <view class="contCon">
  16. <tm-radio-group
  17. :list="configList"
  18. label=""
  19. :defaultValue="item.resultType"
  20. @change="changeSelect"
  21. :setting="{
  22. value: 'value',
  23. name: 'label',
  24. }"
  25. />
  26. </view>
  27. </view>
  28. </view>
  29. <view class="sure-button">
  30. <button @click="sureList">保存</button>
  31. </view>
  32. <tm-tabbar/>
  33. </view>
  34. </template>
  35. <script>
  36. export default {
  37. data() {
  38. return {
  39. resultConfigList: [],
  40. configList: [
  41. {
  42. value: 1,
  43. label: "无需操作",
  44. },
  45. {
  46. value: 2,
  47. label: "需改善回复",
  48. },
  49. {
  50. value: 3,
  51. label: "需使用改善工具",
  52. },
  53. ],
  54. showPopup: false,
  55. radioVal: null,
  56. index: null,
  57. timer:null,
  58. };
  59. },
  60. created() {
  61. this.getResultConfig();
  62. },
  63. methods: {
  64. //获取最新配置
  65. getResultConfig() {
  66. this.$store.dispatch({
  67. type: "configure/commActions",
  68. payload: {
  69. key: "getResultConfig",
  70. },
  71. })
  72. .then((res) => {
  73. this.resultConfigList = res ? res : [];
  74. });
  75. },
  76. //恢复最初配置
  77. recoveryList() {
  78. this.$store.dispatch({
  79. type: "configure/commActions",
  80. payload: {
  81. key: "getDefault",
  82. },
  83. })
  84. .then((res) => {
  85. this.resultConfigList = res ? res : [];
  86. });
  87. },
  88. //保存配置
  89. sureList() {
  90. this.$store.dispatch({
  91. type: "configure/commActions",
  92. payload: {
  93. key: "postResultConfig",
  94. data: {
  95. list: this.resultConfigList,
  96. },
  97. },
  98. })
  99. .then(() => {
  100. this.getResultConfig();
  101. clearTimeout(this.timer)
  102. });
  103. },
  104. showConfig() {
  105. uni.navigateTo({
  106. url: "/pages/configure-detail/detail",
  107. });
  108. },
  109. changeSelect(selectVal, selectData, i) {
  110. this.timer = setTimeout(() => {
  111. this.resultConfigList[this.index].resultType = selectVal;
  112. }, 0);
  113. },
  114. changeIndex(index) {
  115. this.index = index;
  116. },
  117. },
  118. components: {},
  119. };
  120. </script>
  121. <style lang="less">
  122. .configure-page {
  123. height: 100%;
  124. background-color: #f5f6fa;
  125. .greyTitle {
  126. padding: 0rpx 25rpx;
  127. height: 105rpx;
  128. line-height: 105rpx;
  129. font-size: 30rpx;
  130. color: #292c33;
  131. .recovery {
  132. float: right;
  133. text-align: center;
  134. color: #7a8599;
  135. font-size: 22.5rpx;
  136. }
  137. }
  138. .configureCont {
  139. height: calc(100vh - 280rpx);
  140. overflow-y: auto;
  141. }
  142. .configure-cont {
  143. font-size: 22.5rpx;
  144. border-bottom: 0.62rpx solid #dadee6;
  145. background-color: #fff;
  146. .contTitle {
  147. padding: 25rpx 0rpx 15rpx 25rpx;
  148. font-size: 22.5rpx;
  149. color: #666f80;
  150. background-color: #f5f6fa;
  151. }
  152. .contCon {
  153. padding-left: 25rpx;
  154. color: #292c33;
  155. }
  156. .moreImg {
  157. margin-top: 31.23rpx;
  158. margin-right: 18.68rpx;
  159. padding: 1.89rpx 6.31rpx;
  160. float: right;
  161. width: 12.37rpx;
  162. height: 21.21rpx;
  163. }
  164. }
  165. .configure-cont:nth-child(6) {
  166. border-bottom: none;
  167. }
  168. .sure-button {
  169. width: 100%;
  170. position: fixed;
  171. bottom: 100rpx;
  172. button {
  173. width: 625rpx;
  174. height: 62.5rpx;
  175. line-height: 62.5rpx;
  176. border-radius: 37.5rpx;
  177. background-color: #3377ff;
  178. color: #fff;
  179. font-size: 22.5rpx;
  180. }
  181. }
  182. }
  183. </style>