languageDialog.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  1. <template>
  2. <view class="language-popup">
  3. <uni-popup ref="languagePopup" type="dialog">
  4. <uni-popup-dialog>
  5. <view class="popup-title">
  6. <view class="title-content">请选择使用语言</view>
  7. <view class="close-btn" @click="closeDialog()"></view>
  8. </view>
  9. <view class="popup-main">
  10. <view class="checkbox-group">
  11. <view class="lan-block" :class="CNLan.checked === true ? 'lan-block_active' : ''" @click="checkboxChange('CN')">
  12. <view v-if="CNLan.checked === true" class="lan-checkbox">
  13. <checkbox :value="CNLan.value" :checked="CNLan.checked" />
  14. </view>
  15. <view class="lan-flag china"></view>
  16. <view class="lan-text">
  17. <view>{{CNLan.name}}</view>
  18. </view>
  19. </view>
  20. <view class="lan-block" :class="JPLan.checked === true ? 'lan-block_active' : ''" @click="checkboxChange('JP')">
  21. <view v-if="JPLan.checked === true" class="lan-checkbox">
  22. <checkbox :value="JPLan.value" :checked="JPLan.checked" />
  23. </view>
  24. <view class="lan-flag japan"></view>
  25. <view class="lan-text">
  26. <view>{{JPLan.name}}</view>
  27. </view>
  28. </view>
  29. <view class="lan-block" :class="USALan.checked === true ? 'lan-block_active' : ''" @click="checkboxChange('USA')">
  30. <view v-if="USALan.checked === true" class="lan-checkbox">
  31. <checkbox :value="USALan.value" :checked="USALan.checked" />
  32. </view>
  33. <view class="lan-flag usa"></view>
  34. <view class="lan-text">
  35. <view>{{USALan.name}}</view>
  36. </view>
  37. </view>
  38. <view class="lan-block" :class="KRLan.checked === true ? 'lan-block_active' : ''" @click="checkboxChange('KR')">
  39. <view v-if="KRLan.checked === true" class="lan-checkbox">
  40. <checkbox :value="KRLan.value" :checked="KRLan.checked" />
  41. </view>
  42. <view class="lan-flag korea"></view>
  43. <view class="lan-text">
  44. <view>{{KRLan.name}}</view>
  45. </view>
  46. </view>
  47. </view>
  48. </view>
  49. </uni-popup-dialog>
  50. </uni-popup>
  51. </view>
  52. </template>
  53. <script>
  54. export default {
  55. name: 'LanguageDialog',
  56. data() {
  57. return {
  58. CNLan: {
  59. name: '中文',
  60. value: 'CN',
  61. checked: false
  62. },
  63. JPLan: {
  64. name: '日本語.',
  65. value: 'JP',
  66. checked: false
  67. },
  68. USALan: {
  69. name: 'English',
  70. value: 'USA',
  71. checked: false
  72. },
  73. KRLan: {
  74. name: '한국어',
  75. value: 'KR',
  76. checked: false
  77. },
  78. selectLan: 'CN'
  79. };
  80. },
  81. created() {
  82. this.checkboxChange('CN')
  83. },
  84. methods: {
  85. openDialog() {
  86. this.$refs.languagePopup.open("center");
  87. },
  88. closeDialog() {
  89. this.$refs.languagePopup.close();
  90. },
  91. checkboxChange(type) {
  92. if (type == 'CN') {
  93. this.CNLan.checked = true;
  94. this.JPLan.checked = false;
  95. this.USALan.checked = false;
  96. this.KRLan.checked = false;
  97. this.selectLan = this.CNLan.value;
  98. this.$emit('get-language-change' , this.selectLan)
  99. }
  100. if (type == 'JP') {
  101. this.CNLan.checked = false;
  102. this.JPLan.checked = true;
  103. this.USALan.checked = false;
  104. this.KRLan.checked = false;
  105. this.selectLan = this.JPLan.value;
  106. this.$emit('get-language-change' , this.selectLan)
  107. }
  108. if (type == 'USA') {
  109. this.CNLan.checked = false;
  110. this.JPLan.checked = false;
  111. this.USALan.checked = true;
  112. this.KRLan.checked = false;
  113. this.selectLan = this.USALan.value;
  114. this.$emit('get-language-change' , this.selectLan)
  115. }
  116. if (type == 'KR') {
  117. this.CNLan.checked = false;
  118. this.JPLan.checked = false;
  119. this.USALan.checked = false;
  120. this.KRLan.checked = true;
  121. this.selectLan = this.KRLan.value;
  122. this.$emit('get-language-change' , this.selectLan)
  123. }
  124. }
  125. },
  126. };
  127. </script>
  128. <style scoped lang="scss">
  129. ::v-deep .uni-popup-dialog {
  130. width: 840px;
  131. height: 378px;
  132. background: #FFFFFF;
  133. border-radius: 20px;
  134. .uni-dialog-title {
  135. display: none;
  136. }
  137. .uni-dialog-button-group {
  138. display: none;
  139. }
  140. .uni-dialog-content {
  141. padding: 0;
  142. display: block;
  143. .popup-title {
  144. width: 100%;
  145. text-align: center;
  146. padding-top: 30px;
  147. position: relative;
  148. .title-content {
  149. font-family: PingFangSC, PingFang SC;
  150. font-weight: 600;
  151. font-size: 20px;
  152. color: #000000;
  153. line-height: 28px;
  154. font-style: normal;
  155. }
  156. .close-btn {
  157. width: 18px;
  158. height: 18px;
  159. background-image: url("@/static/public/img/close.png");
  160. background-size: 100% 100%;
  161. background-repeat: no-repeat;
  162. background-position: center center;
  163. position: absolute;
  164. right: 30px;
  165. top: 35px;
  166. }
  167. }
  168. .popup-main {
  169. padding: 30px;
  170. .checkbox-group {
  171. display: flex;
  172. justify-content: space-between;
  173. .lan-block {
  174. width: 180px;
  175. height: 260px;
  176. background: #FAFAFA;
  177. border-radius: 20px;
  178. border: 1px solid rgba(0,0,0,0.08);
  179. display: flex;
  180. flex-direction: column;
  181. align-items: center;
  182. position: relative;
  183. .lan-flag {
  184. width: 100px;
  185. height: 67px;
  186. background-size: 100% 100%;
  187. background-repeat: no-repeat;
  188. background-position: center center;
  189. margin-top: 70px;
  190. }
  191. .china {
  192. background-image: url("@/static/public/img/china-flag.png");
  193. }
  194. .japan {
  195. background-image: url("@/static/public/img/japan-flag.png");
  196. }
  197. .usa {
  198. background-image: url("@/static/public/img/usa-flag.png");
  199. }
  200. .korea {
  201. background-image: url("@/static/public/img/korea-flag.png");
  202. }
  203. .lan-text {
  204. margin-top: 24px;
  205. font-family: AppleSDGothicNeo, AppleSDGothicNeo;
  206. font-weight: 600;
  207. font-size: 24px;
  208. color: rgba(0,0,0,0.8);
  209. line-height: 29px;
  210. font-style: normal;
  211. }
  212. }
  213. .lan-block_active {
  214. background: rgba(4,184,91,0.1);
  215. border: 1px solid #04B85B;
  216. .lan-checkbox {
  217. position: absolute;
  218. right: 10px;
  219. top: 10px;
  220. uni-checkbox {
  221. .uni-checkbox-wrapper {
  222. .uni-checkbox-input {
  223. width: 24px;
  224. height: 24px;
  225. border-radius: 50%;
  226. background: linear-gradient( 329deg, #04B85B 0%, #2ECD7B 100%);
  227. }
  228. }
  229. }
  230. uni-checkbox::before {
  231. margin-top: -8px;
  232. right: 5px;
  233. font-size: 16px;
  234. }
  235. }
  236. }
  237. }
  238. }
  239. }
  240. }
  241. </style>