uni-agreements.vue 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <template>
  2. <view class="root">
  3. <checkbox-group @change="setAgree" class="checkbox-group">
  4. <checkbox style="transform: scale(0.7);" />
  5. <text>同意</text>
  6. </checkbox-group>
  7. <template v-for="(agreement,index) in agreements">
  8. <text class="agreement" @click="navigateTo(agreement)">{{agreement.title}}</text>
  9. <text class="hint" v-if="hasAnd(agreements,index)">和</text>
  10. </template>
  11. </view>
  12. </template>
  13. <script>
  14. export default {
  15. name:"uni-agreements",
  16. computed:{
  17. agreements(){
  18. return getApp().globalData.config.about.agreements||[]
  19. }
  20. },
  21. methods:{
  22. navigateTo({url,title}){
  23. uni.navigateTo({
  24. url: '/pages/common/webview/webview?url='+url+'&title='+title,
  25. success: res => {},
  26. fail: () => {},
  27. complete: () => {}
  28. });
  29. },
  30. hasAnd(agreements,index){
  31. return agreements.length-1>index
  32. },
  33. setAgree(e){
  34. this.isAgree = !this.isAgree
  35. this.$emit('setAgree',this.isAgree)
  36. }
  37. },
  38. data() {
  39. return {
  40. isAgree:false
  41. };
  42. }
  43. }
  44. </script>
  45. <style>
  46. .root{
  47. flex-direction: row;
  48. align-items: center;
  49. font-size: 28rpx;
  50. color: #8a8f8b;
  51. }
  52. .checkbox-group{
  53. align-items: center;
  54. display: flex;
  55. flex-direction: row;
  56. }
  57. .agreement{
  58. color:#04498c;
  59. }
  60. </style>