百富门答题小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

242 lines
4.6 KiB

8 months ago
6 months ago
8 months ago
6 months ago
8 months ago
6 months ago
8 months ago
6 months ago
8 months ago
6 months ago
8 months ago
6 months ago
8 months ago
6 months ago
8 months ago
6 months ago
8 months ago
6 months ago
6 months ago
8 months ago
6 months ago
8 months ago
6 months ago
8 months ago
6 months ago
8 months ago
6 months ago
8 months ago
  1. <template>
  2. <view class="home">
  3. <image src="/static/image/bg/1.png"
  4. class="page-bg"
  5. mode="aspectFill"></image>
  6. <!-- next1 -->
  7. <view class="content_now" v-if="stop == 1">
  8. <view class=""
  9. v-if="probleme[index]"
  10. v-html="$utils.stringFormatHtml(probleme[index].title)">
  11. </view>
  12. <!-- <view class="mian-btn"
  13. :class="{active:isActive === '是'}"
  14. @click="setActive('是')"></view>
  15. <view class="mian-btn"
  16. :class="{active:isActive === '否'}"
  17. @click="setActive('否')"></view> -->
  18. <view class="mian-btn"
  19. v-for="(item, index) in probleme[index] && probleme[index].danan && probleme[index].danan.split(',')"
  20. :class="{active:isActive === item}"
  21. :key="index"
  22. @click="setActive(item)">{{ item }}</view>
  23. </view>
  24. <!-- next2 -->
  25. <view class="content_now" v-if="stop == 2">
  26. <text class="font-bold mb-60">请选择您所在的区域</text>
  27. <view class="">
  28. <picker
  29. mode="region"
  30. :value="date"
  31. class="u-w-440"
  32. @change="bindTimeChange">
  33. <view class="region">
  34. <view class="">
  35. {{ address.province}}
  36. </view>
  37. <view class="">
  38. {{ address.city}}
  39. </view>
  40. <view class="">
  41. {{ address.district}}
  42. </view>
  43. </view>
  44. </picker>
  45. </view>
  46. </view>
  47. <view class="an">
  48. <!-- <view style="display: flex;width: 600rpx;"
  49. v-if="stop == 1">
  50. <view class="next-btn"
  51. v-if="index > 0"
  52. @click="index--">
  53. 上一题
  54. </view>
  55. <view class="next-btn"
  56. @click="next">
  57. 下一题
  58. </view>
  59. </view> -->
  60. <view class="next-btn"
  61. v-if="stop == 1"
  62. @click="next">
  63. 下一题
  64. </view>
  65. <view class="next-btn"
  66. v-if="stop == 2"
  67. @click="next">
  68. 提交
  69. </view>
  70. <text class="second-color">{{ configList.bg_title }}</text>
  71. </view>
  72. </view>
  73. </template>
  74. <script>
  75. import { mapState } from 'vuex'
  76. export default {
  77. data() {
  78. return {
  79. isActive : null,
  80. stop : 1,
  81. index : 0,
  82. address : {
  83. province : '',
  84. city : '',
  85. district : '',
  86. }
  87. }
  88. },
  89. computed : {
  90. ...mapState(['problemList', 'configList', 'queryMyLog']),
  91. probleme(){
  92. let ids = []
  93. for(let i = 0;i < this.queryMyLog.length;i++){
  94. ids.push(this.queryMyLog[i].topId)
  95. }
  96. return this.problemList.filter(n => {
  97. return !ids.includes(n.id)
  98. })
  99. },
  100. },
  101. onLoad() {
  102. if(this.probleme.length == 0){
  103. this.stop++
  104. }
  105. let address = uni.getStorageSync('user_address')
  106. if(address){
  107. this.address = JSON.parse(address)
  108. }
  109. },
  110. onShow() {
  111. },
  112. methods: {
  113. setActive(value){
  114. this.isActive = value
  115. },
  116. next(){
  117. this['next' + this.stop]()
  118. },
  119. next1(){
  120. if(this.isActive){
  121. this.$api('submitLog', {
  122. topId : this.probleme[this.index].id,
  123. context : this.isActive,
  124. }, res => {
  125. this.isActive = null
  126. if(this.index == this.probleme.length - 1){
  127. this.stop = 2
  128. }else{
  129. this.index++
  130. }
  131. })
  132. }else{
  133. uni.showToast({
  134. title:'请选择后进行下一题',
  135. icon: 'none'
  136. })
  137. }
  138. },
  139. next2(){
  140. // this.stop = 3
  141. if(!this.address.province){
  142. uni.showToast({
  143. title:'请选择地址后进行下一题',
  144. icon: 'none'
  145. })
  146. return
  147. }
  148. uni.redirectTo({
  149. url: '/pages_order/info/fillInfo'
  150. })
  151. },
  152. // 获取省市区
  153. bindTimeChange(e) {
  154. this.address.province = e.detail.value[0];
  155. this.address.city = e.detail.value[1];
  156. this.address.district = e.detail.value[2];
  157. this.address.provinceName = e.detail.value[0] + e.detail.value[1] + e.detail.value[2];
  158. uni.setStorageSync('user_address', JSON.stringify(this.address))
  159. },
  160. }
  161. }
  162. </script>
  163. <style lang="scss" scoped>
  164. .region{
  165. display: flex;
  166. align-items: center;
  167. &>view{
  168. width: 140rpx;
  169. height: 50rpx;
  170. border-radius: 10rpx;
  171. border: 1px solid #e6bf7f;
  172. margin: 0 10rpx;
  173. line-height: 50rpx;
  174. text-align: center;
  175. }
  176. }
  177. .b-btn{
  178. width: 86%;
  179. display: flex;
  180. justify-content: center;
  181. padding-top: 130rpx;
  182. .pre-btn{
  183. border: 4rpx solid #f1e0c6;
  184. padding: 16rpx 90rpx;
  185. border-radius: 66rpx;
  186. color: #e6bf7f;
  187. }
  188. }
  189. .next-btn{
  190. background-image: url('../../static/image/home/btn.png');
  191. background-size: contain;
  192. background-repeat: no-repeat;
  193. background-position: center;
  194. width: 280rpx;
  195. display: flex;
  196. align-items: center;
  197. justify-content: center;
  198. color: white;
  199. padding: 16rpx 90rpx;
  200. }
  201. .an{
  202. position: fixed;
  203. bottom: 300rpx;
  204. text-align: center;
  205. display: flex;
  206. flex-direction: column;
  207. align-items: center;
  208. justify-content: center;
  209. width: 100%;
  210. }
  211. </style>