configure.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  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
  67. .dispatch({
  68. type: "configure/commActions",
  69. payload: {
  70. key: "getResultConfig",
  71. },
  72. })
  73. .then((res) => {
  74. this.resultConfigList = res ? res : [];
  75. });
  76. },
  77. //恢复最初配置
  78. recoveryList() {
  79. this.$store
  80. .dispatch({
  81. type: "configure/commActions",
  82. payload: {
  83. key: "getDefault",
  84. },
  85. })
  86. .then((res) => {
  87. this.resultConfigList = res ? res : [];
  88. });
  89. },
  90. //保存配置
  91. sureList() {
  92. this.$store
  93. .dispatch({
  94. type: "configure/commActions",
  95. payload: {
  96. key: "postResultConfig",
  97. data: {
  98. list: this.resultConfigList,
  99. },
  100. },
  101. })
  102. .then(() => {
  103. this.getResultConfig();
  104. clearTimeout(this.timer);
  105. });
  106. },
  107. showConfig() {
  108. uni.navigateTo({
  109. url: "/pages/configure-detail/detail",
  110. });
  111. },
  112. changeSelect(selectVal, selectData, i) {
  113. this.timer = setTimeout(() => {
  114. this.resultConfigList[this.index].resultType = selectVal;
  115. }, 0);
  116. },
  117. changeIndex(index) {
  118. this.index = index;
  119. },
  120. },
  121. components: {},
  122. };
  123. </script>
  124. <style lang="less">
  125. .configure-page {
  126. height: 100%;
  127. background-color: #f5f6fa;
  128. .greyTitle {
  129. padding: 0rpx 25rpx;
  130. height: 105rpx;
  131. line-height: 105rpx;
  132. font-size: 30rpx;
  133. color: #292c33;
  134. .recovery {
  135. float: right;
  136. text-align: center;
  137. color: #7a8599;
  138. font-size: 22.5rpx;
  139. }
  140. }
  141. .configureCont {
  142. height: calc(100vh - 280rpx);
  143. overflow-y: auto;
  144. }
  145. .configure-cont {
  146. font-size: 22.5rpx;
  147. border-bottom: 0.62rpx solid #dadee6;
  148. background-color: #fff;
  149. .contTitle {
  150. padding: 25rpx 0rpx 15rpx 25rpx;
  151. font-size: 22.5rpx;
  152. color: #666f80;
  153. background-color: #f5f6fa;
  154. }
  155. .contCon {
  156. padding-left: 25rpx;
  157. color: #292c33;
  158. }
  159. .moreImg {
  160. margin-top: 31.23rpx;
  161. margin-right: 18.68rpx;
  162. padding: 1.89rpx 6.31rpx;
  163. float: right;
  164. width: 12.37rpx;
  165. height: 21.21rpx;
  166. }
  167. }
  168. .configure-cont:nth-child(6) {
  169. border-bottom: none;
  170. }
  171. .sure-button {
  172. width: 100%;
  173. position: fixed;
  174. bottom: 100rpx;
  175. button {
  176. width: 625rpx;
  177. height: 62.5rpx;
  178. line-height: 62.5rpx;
  179. border-radius: 37.5rpx;
  180. background-color: #3377ff;
  181. color: #fff;
  182. font-size: 22.5rpx;
  183. }
  184. }
  185. }
  186. </style>