百富门答题小程序
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.

307 lines
5.7 KiB

5 months ago
3 weeks ago
3 months ago
3 weeks ago
3 months ago
3 weeks ago
3 months ago
3 weeks ago
3 months ago
3 weeks ago
3 months ago
3 weeks ago
3 months ago
3 weeks ago
3 months ago
3 weeks ago
3 months ago
3 weeks ago
3 months ago
3 weeks ago
5 months ago
3 months ago
3 weeks ago
5 months ago
3 weeks ago
3 months ago
3 weeks ago
3 months ago
3 weeks ago
3 months ago
5 months ago
3 months ago
5 months ago
3 months ago
5 months ago
3 months ago
3 weeks ago
5 months ago
3 months ago
3 weeks ago
3 months ago
3 weeks ago
3 months ago
5 months ago
3 weeks ago
2 weeks ago
5 months ago
3 weeks ago
3 months ago
3 weeks ago
3 weeks ago
3 weeks ago
3 months ago
5 months ago
3 weeks ago
3 months ago
5 months ago
3 months ago
5 months ago
3 months ago
3 weeks ago
3 months ago
3 weeks ago
3 months ago
3 weeks ago
3 months ago
5 months ago
3 weeks ago
5 months ago
  1. <template>
  2. <view class="page">
  3. <image :src="configList.img_13"
  4. class="page-bg"
  5. mode="aspectFill"></image>
  6. <image :src="configList.img_7"
  7. class="logo"
  8. mode="widthFix"></image>
  9. <!-- next1 -->
  10. <view class="content" v-if="question[index]">
  11. <image :src="configList.img_11"
  12. class="content-bg"
  13. mode="aspectFill"></image>
  14. <view class=""
  15. v-html="$utils.stringFormatHtml(question[index].title)">
  16. </view>
  17. <view class="mian-btn"
  18. v-for="(item, i) in question[index].answerObjectSkuList"
  19. :class="{active : answerIds[index] == item.id}"
  20. :key="i"
  21. @click="select(item)">
  22. {{ item.title }}
  23. </view>
  24. </view>
  25. <!-- next2 -->
  26. <view class="content" v-if="stop == 2">
  27. <text class="font-bold mb-60">请选择您所在的区域</text>
  28. <view class="">
  29. <picker
  30. mode="region"
  31. :value="date"
  32. class="u-w-440"
  33. @change="bindTimeChange">
  34. <view class="region">
  35. <view class="">
  36. {{ address.province}}
  37. </view>
  38. <view class="">
  39. {{ address.city}}
  40. </view>
  41. <view class="">
  42. {{ address.district}}
  43. </view>
  44. </view>
  45. </picker>
  46. </view>
  47. </view>
  48. <view class="an">
  49. <view style="display: flex;gap: 30rpx;"
  50. >
  51. <view class="next-btn-2"
  52. v-if="index > 0"
  53. @click="ret">
  54. 上一题
  55. </view>
  56. <view class="next-btn"
  57. @click="next1">
  58. 下一题
  59. </view>
  60. </view>
  61. <!-- <view class="next-btn"
  62. v-if="stop == 1"
  63. @click="next">
  64. 下一题
  65. </view>
  66. <view class="next-btn"
  67. v-if="stop == 2"
  68. @click="next">
  69. 提交
  70. </view> -->
  71. <text class="second-color">{{ configList.bg_title }}</text>
  72. </view>
  73. </view>
  74. </template>
  75. <script>
  76. import { mapState } from 'vuex'
  77. export default {
  78. data() {
  79. return {
  80. isActive : null,
  81. stop : 1,
  82. index : 0,
  83. address : {
  84. province : '',
  85. city : '',
  86. district : '',
  87. },
  88. question : [],
  89. answerIds : [],
  90. }
  91. },
  92. computed : {
  93. ...mapState(['configList']),
  94. },
  95. onLoad() {
  96. this.firstQuestion()
  97. },
  98. onShow() {
  99. },
  100. methods: {
  101. select(item){
  102. this.answerIds.splice(this.index, 1, item.id)
  103. if(item.isEnd != 'Y'){
  104. this.isActive = item.toMainId
  105. }
  106. },
  107. ret(){
  108. this.index--
  109. this.isActive = null
  110. this.question[this.index]
  111. .answerObjectSkuList.forEach(n => {
  112. if(n.id == this.answerIds[this.index]){
  113. this.isActive = n.toMainId
  114. }
  115. })
  116. },
  117. firstQuestion(){
  118. this.$api('firstQuestion', res => {
  119. if(res.code == 200){
  120. this.question.push(res.result)
  121. }
  122. })
  123. },
  124. next1(){
  125. if(!this.isActive){
  126. uni.showToast({
  127. title:'请选择后进行下一题',
  128. icon: 'none'
  129. })
  130. return
  131. }
  132. let item = null
  133. this.question[this.index]
  134. .answerObjectSkuList.forEach(n => {
  135. if(n.id == this.answerIds[this.index]){
  136. item = n
  137. }
  138. })
  139. if(item.isEnd == 'Y'){
  140. this.$store.commit('getTitleByIds', item.toRuleId)
  141. return
  142. }
  143. this.$api('getProblemById', {
  144. id : this.isActive
  145. }, res => {
  146. if(res.code == 200){
  147. this.index++
  148. this.question.splice(this.index, 1, res.result)
  149. }
  150. })
  151. // this.$api('submitLog', {
  152. // topId : this.probleme[this.index].id,
  153. // context : this.isActive,
  154. // }, res => {
  155. // this.isActive = null
  156. // if(this.index == this.probleme.length - 1){
  157. // this.stop = 2
  158. // }else{
  159. // uni.navigateTo({
  160. // url: '/pages/index/preAppoint'
  161. // })
  162. // }
  163. // })
  164. },
  165. next2(){
  166. // this.stop = 3
  167. if(!this.address.province){
  168. uni.showToast({
  169. title:'请选择地址后进行下一题',
  170. icon: 'none'
  171. })
  172. return
  173. }
  174. uni.redirectTo({
  175. url: '/pages_order/info/fillInfo'
  176. })
  177. },
  178. // 获取省市区
  179. bindTimeChange(e) {
  180. this.address.province = e.detail.value[0];
  181. this.address.city = e.detail.value[1];
  182. this.address.district = e.detail.value[2];
  183. this.address.provinceName = e.detail.value[0] + e.detail.value[1] + e.detail.value[2];
  184. uni.setStorageSync('user_address', JSON.stringify(this.address))
  185. },
  186. }
  187. }
  188. </script>
  189. <style lang="scss" scoped>
  190. .page{
  191. .logo{
  192. width: 600rpx;
  193. margin: 150rpx 75rpx;
  194. }
  195. .content{
  196. position: relative;
  197. display: flex;
  198. flex-direction: column;
  199. align-items: center;
  200. justify-content: center;
  201. box-sizing: border-box;
  202. padding: 0 60rpx;
  203. text-align: center;
  204. width: 700rpx;
  205. height: 650rpx;
  206. margin: 0 25rpx;
  207. .content-bg{
  208. height: 100%;
  209. width: 100%;
  210. position: absolute;
  211. top: 0;
  212. left: 0;
  213. z-index: -1;
  214. }
  215. }
  216. }
  217. .region{
  218. display: flex;
  219. align-items: center;
  220. &>view{
  221. width: 140rpx;
  222. height: 50rpx;
  223. border-radius: 10rpx;
  224. border: 1px solid #e6bf7f;
  225. margin: 0 10rpx;
  226. line-height: 50rpx;
  227. text-align: center;
  228. }
  229. }
  230. .b-btn{
  231. width: 86%;
  232. display: flex;
  233. justify-content: center;
  234. padding-top: 130rpx;
  235. .pre-btn{
  236. border: 4rpx solid #f1e0c6;
  237. padding: 16rpx 90rpx;
  238. border-radius: 66rpx;
  239. color: #e6bf7f;
  240. }
  241. }
  242. .next-btn{
  243. width: 120rpx;
  244. display: flex;
  245. align-items: center;
  246. justify-content: center;
  247. color: white;
  248. padding: 16rpx 90rpx;
  249. background-color: $uni-color;
  250. border-radius: 30rpx;
  251. }
  252. .next-btn-2{
  253. width: 120rpx;
  254. display: flex;
  255. align-items: center;
  256. justify-content: center;
  257. color: white;
  258. padding: 16rpx 90rpx;
  259. background-color: $uni-color-primary;
  260. border-radius: 30rpx;
  261. }
  262. .an{
  263. position: fixed;
  264. bottom: 300rpx;
  265. text-align: center;
  266. display: flex;
  267. flex-direction: column;
  268. align-items: center;
  269. justify-content: center;
  270. width: 100%;
  271. }
  272. .second-color{
  273. margin-top: 20rpx;
  274. }
  275. </style>