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.

261 lines
6.2 KiB

3 months ago
  1. <template>
  2. <view class="content" id="brushQuestions">
  3. <up-navbar leftText=" " title="" :safeAreaInsetTop="false" :autoBack="true">
  4. <template #center>
  5. <view class="u-nav-slot flex">
  6. <view class="btn" @click="changeNav(1)" :class="{active: currentNav==1}">答题模式</view>
  7. <view class="btn" @click="changeNav(2)" :class="{active: currentNav==2}">背题模式</view>
  8. </view>
  9. </template>
  10. </up-navbar>
  11. <view class="con padding">
  12. <view class="h1_row">
  13. <text class="tag">单选</text>
  14. <text class="h1">机动车驾驶人在实习期内驾驶机动车不得牵引挂车</text>
  15. </view>
  16. <view class="option">
  17. <view class="optionItem flex">
  18. <view class="icon">
  19. <image src="@/static/logo.png" mode=""></image>
  20. </view>
  21. <view class="text">正确</view>
  22. </view>
  23. </view>
  24. <view class="answer flex">
  25. <view class="ans">正确答案是<text>B</text></view>
  26. <view class="ans">您的答案是<text>B</text></view>
  27. </view>
  28. <view class="analysis">
  29. <view class="tit">题目解析</view>
  30. <view class="txt">解析解析解析解析解析解析解析解析解析解析解析解析</view>
  31. </view>
  32. </view>
  33. <view class="con padding">
  34. <view class="h1_row">
  35. <text class="tag">单选</text>
  36. <text class="h1">机动车驾驶人在实习期内驾驶机动车不得牵引挂车</text>
  37. </view>
  38. <view class="option">
  39. <view class="optionItem flex">
  40. <view class="icon">
  41. <image src="@/static/logo.png" mode=""></image>
  42. </view>
  43. <view class="text">正确</view>
  44. </view>
  45. </view>
  46. <view class="answer flex">
  47. <view class="ans">正确答案是<text>B</text></view>
  48. <view class="ans">您的答案是<text>B</text></view>
  49. </view>
  50. <view class="analysis">
  51. <view class="tit">题目解析</view>
  52. <view class="txt">解析解析解析解析解析解析解析解析解析解析解析解析</view>
  53. </view>
  54. </view>
  55. <view class="con padding">
  56. <view class="h1_row">
  57. <text class="tag">单选</text>
  58. <text class="h1">机动车驾驶人在实习期内驾驶机动车不得牵引挂车</text>
  59. </view>
  60. <view class="option">
  61. <view class="optionItem flex">
  62. <view class="icon">
  63. <image src="@/static/logo.png" mode=""></image>
  64. </view>
  65. <view class="text">正确</view>
  66. </view>
  67. </view>
  68. <view class="answer flex">
  69. <view class="ans">正确答案是<text>B</text></view>
  70. <view class="ans">您的答案是<text>B</text></view>
  71. </view>
  72. <view class="analysis">
  73. <view class="tit">题目解析</view>
  74. <view class="txt">解析解析解析解析解析解析解析解析解析解析解析解析</view>
  75. </view>
  76. </view>
  77. <u-popup :show="show" mode="center">
  78. <view>
  79. <text>出淤泥而不染濯清涟而不妖</text>
  80. </view>
  81. </u-popup>
  82. </view>
  83. </template>
  84. <script>
  85. export default {
  86. data() {
  87. return {
  88. currentNav: '1',
  89. show: true,
  90. }
  91. },
  92. mounted() {
  93. this.$nextTick(()=>{
  94. this.detectOrient();
  95. })
  96. },
  97. methods: {
  98. changeNav(val) {
  99. console.log(window)
  100. if(this.currentNav == val) return
  101. this.currentNav = val
  102. },
  103. detectOrient() {
  104. var width = document.documentElement.clientWidth,
  105. height = document.documentElement.clientHeight,
  106. // $wrapper = document.getElementsByTagName('body')[0],
  107. $wrapper = document.querySelector('#brushQuestions'),
  108. style = "";
  109. if (width >= height) { // 横屏
  110. style += "width:" + width + "px;"; // 注意旋转后的宽高切换
  111. style += "height:" + height + "px;";
  112. style += "-webkit-transform: rotate(0); transform: rotate(0);";
  113. style += "-webkit-transform-origin: 0 0;";
  114. style += "transform-origin: 0 0;";
  115. console.log(1)
  116. } else { // 竖屏
  117. style += "width:" + height + "px;";
  118. style += "height:" + width + "px;";
  119. style += "-webkit-transform: rotate(90deg); transform: rotate(90deg);";
  120. // 注意旋转中点的处理
  121. style += "-webkit-transform-origin: " + width / 2 + "px " + width / 2 + "px;";
  122. style += "transform-origin: " + width / 2 + "px " + width / 2 + "px;";
  123. console.log(2)
  124. }
  125. $wrapper.style.cssText = style;
  126. }
  127. }
  128. }
  129. </script>
  130. <style lang="scss" scoped>
  131. uni-page-body {
  132. width: 100%;
  133. height: 100%;
  134. }
  135. html{
  136. width: 100vh;
  137. height: 100vw;
  138. -webkit-transform: rotate(90deg);
  139. -webkit-transform-origin: 50vw 50vw;
  140. transform: rotate(90deg);
  141. transform-origin: 50vw 50vw;
  142. }
  143. image {display: block;width: 100%;height: 100%;}
  144. .content {
  145. padding: 0rpx 0 0rpx 0rpx;
  146. width: 100%;
  147. height: 100%;
  148. overflow: auto;
  149. .u-nav-slot {
  150. width: 306rpx;
  151. height: 54rpx;
  152. border-radius: 10rpx;
  153. border: 1px solid #333333;
  154. display: flex;
  155. .btn {
  156. font-size: 24rpx;
  157. color: #333333;
  158. flex: 1;
  159. text-align: center;
  160. line-height: 54rpx;
  161. &.active {
  162. background-color: #333333;
  163. color: #fff;
  164. }
  165. }
  166. }
  167. .con {
  168. .h1_row {
  169. margin-bottom: 50rpx;
  170. .tag {
  171. display: inline-block;
  172. // width: 66px;
  173. height: 36rpx;
  174. line-height: 36rpx;
  175. padding: 4rpx 6rpx;
  176. background: #63C168;
  177. border-radius: 6rpx;
  178. margin-top: -2rpx;
  179. margin-right: 16rpx;
  180. font-size: 28rpx;
  181. color: #fff;
  182. }
  183. text.h1 {
  184. font-size: 36rpx;
  185. }
  186. }
  187. .option {
  188. width: 100%;
  189. .optionItem {
  190. margin-bottom: 50rpx;
  191. align-items: center;
  192. .icon {
  193. width: 56rpx;
  194. height: 56rpx;
  195. margin-right: 36rpx;
  196. image {
  197. border-radius: 50%;
  198. }
  199. }
  200. .text {
  201. font-size: 32rpx;
  202. }
  203. }
  204. }
  205. .answer {
  206. height: 90rpx;
  207. background: #F4F4F4;
  208. line-height: 90rpx;
  209. padding: 0 30rpx;
  210. margin-top: 20rpx;
  211. .ans {
  212. margin-right: 60rpx;
  213. text {
  214. color: red;
  215. }
  216. }
  217. }
  218. .analysis {
  219. margin-top: 60rpx;
  220. .tit {
  221. font-weight: 700;
  222. font-size: 32rpx;
  223. position: relative;
  224. padding-left: 30rpx;
  225. &::after {
  226. content: '';
  227. position: absolute;
  228. left: 0;
  229. top: 8rpx;
  230. width: 6rpx;
  231. height: 30rpx;
  232. background: linear-gradient(0deg, #43EA80 0%, #38F8D4 100%);
  233. border-radius: 3rpx;
  234. }
  235. }
  236. .txt {
  237. margin-top: 39rpx;
  238. font-size: 32rpx;
  239. color: #333333;
  240. }
  241. }
  242. }
  243. }
  244. </style>